#include <bits/stdc++.h>
using namespace std;
int main(){
int R, C;
cin>>R>>C;
char w[R][C];
//輸入
for(int i = 0; i < R; i++)
for(int j = 0; j < C; j++)
cin>>w[i][j];
string s;
cin>>s;
int y = 76, x = 76, y1 = 0, x1 = 0, size = (int)s.size();
//開始
for(int i = 0; i < R; i++){
for(int j = 0; j < C; j++){
//上
if(i - size > -2){
bool a = 1;
for(int k = 0; k < size; k++){
if(w[i-k][j] != s[k] && w[i-k][j] != s[k]+32 && w[i-k][j]+32 != s[k]){
a = 0;
break;
}
}
if(a == 1){
if(i < y){
x = j;
x1 = j;
y = i;
y1 = i - size + 1;
}
else if(j < x){
x = j;
x1 = j;
y = i;
y1 = i - size + 1;
}
}
}
//下
if(i + size < R + 1){
bool a = 1;
for(int k = 0; k < size; k++){
if(w[i+k][j]+32 != s[k] && w[i+k][j] != s[k]+32 && w[i+k][j] != s[k]){
a = 0;
break;
}
}
if(a == 1){
if(i < y){
x = j;
x1 = j;
y = i;
y1 = i + size - 1;
}
else if(j < x){
x = j;
x1 = j;
y = i;
y1 = i + size - 1;
}
}
}
//右
if(j + size < C + 1){
bool a = 1;
for(int k = 0; k < size; k++){
if(w[i][j+k]+32 != s[k] && w[i][j+k] != s[k]+32 && w[i][j+k] != s[k]){
a = 0;
break;
}
}
if(a == 1){
if(i < y){
x = j;
x1 = j + size - 1;
y = i;
y1 = i;
}
else if(j < x){
x = j;
x1 = j + size - 1;
y = i;
y1 = i;
}
}
}
//左
if(j - size > -2){
bool a = 1;
for(int k = 0; k < size; k++){
if(w[i][j-k]+32 != s[k] && w[i][j-k] != s[k]+32 && w[i][j-k] != s[k]){
a = 0;
break;
}
}
if(a == 1){
if(i < y){
x = j;
x1 = j - size + 1;
y = i;
y1 = i;
}
else if(j < x){
x = j;
x1 = j - size + 1;
y = i;
y1 = i;
}
}
}
//右下
if(i + size < R + 1 && j + size < C + 1){
bool a = 1;
for(int k = 0; k < size; k++){
if(w[i+k][j+k]+32 != s[k] && w[i+k][j+k] != s[k]+32 && w[i+k][j+k] != s[k]){
a = 0;
break;
}
}
if(a == 1){
if(i < y){
x = j;
x1 = j + size - 1;
y = i;
y1 = i + size - 1;
}
else if(j < x){
x = j;
x1 = j + size - 1;
y = i;
y1 = i + size - 1;
}
}
}
//右上
if(j + size < C + 1 && i - size > -2){
bool a = 1;
for(int k = 0; k < size; k++){
if(w[i-k][j+k]+32 != s[k] && w[i-k][j+k] != s[k]+32 && w[i-k][j+k] != s[k]){
a = 0;
break;
}
}
if(a == 1){
if(i < y){
x = j;
x1 = j + size - 1;
y = i;
y1 = i - size + 1;
}
else if(j < x){
x = j;
x1 = j + size - 1;
y = i;
y1 = i - size + 1;
}
}
}
//左上
if(j - size > -2 && i - size > -2){
bool a = 1;
for(int k = 0; k < size; k++){
if(w[i-k][j-k]+32 != s[k] && w[i-k][j-k] != s[k]+32 && w[i-k][j-k] != s[k]){
a = 0;
break;
}
}
if(a == 1){
if(i < y){
x = j;
x1 = j - size + 1;
y = i;
y1 = i - size + 1;
}
else if(j < x){
x = j;
x1 = j - size + 1;
y = i;
y1 = i - size + 1;
}
}
}
//左下
if(j - size > -2 && i + size < R + 1){
bool a = 1;
for(int k = 0; k < size; k++){
if(w[i+k][j-k]+32 != s[k] && w[i+k][j-k] != s[k]+32 && w[i+k][j-k] != s[k]){
a = 0;
break;
}
}
if(a == 1){
if(i < y){
x = j;
x1 = j - size + 1;
y = i;
y1 = i + size - 1;
}
else if(j < x){
x = j;
x1 = j - size + 1;
y = i;
y1 = i + size - 1;
}
}
}
}
}
//NO
if(y == 0 && x == 76)
cout<<"NO\n";
//YES
else cout<<y+1<<" "<<x+1<<"\n"<<y1+1<<" "<<x1+1<<"\n";
}