
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<queue>
#include<vector>
#include<functional>
#include<cmath>
#include<map>
#include<stack>
#include<set>
#include<numeric>
#include<limits>
#include<iterator>

#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ll, char> plc;

int n, m;
int field[110][110];
vector<vector<int> > p;

vector<vector<int> > rotate90() {
	vector<vector<int> > temp;
	temp = p;
	for (int i = 0; i < m; i++) 
		for (int j = 0; j < m; j++) 
			temp[i][j] = p[m-j-1][i];
	return temp;
}


vector<vector<int> > l_rotate90() {
	vector<vector<int> > temp;
	temp = p;
	for (int i = 0; i < m; i++) 
		for (int j = 0; j < m; j++) 
			temp[i][j] = p[j][m-i-1];
	return temp;
}

vector<vector<int> > rotate180() {
	vector<vector<int> > temp;
	temp = p;
	for (int i = 0; i < m; i++) 
		for (int j = 0; j < m; j++) 
			temp[i][j] = p[m-i-1][m-j-1];
	return temp;
}

vector<vector<int> > l_rotate180() {
	vector<vector<int> > temp;
	temp = p;
	for (int i = 0; i < m; i++) 
		for (int j = 0; j < m; j++) 
			temp[i][j] = p[m - i - 1][m - j - 1];
	return temp;
}


vector<vector<int> > rotate270() {
	vector<vector<int> > temp;
	temp = p;
	for (int i = 0; i < m; i++) 
		for (int j = 0; j < m; j++) 
			temp[i][j] = p[j][m-i-1];
	return temp;
}

vector<vector<int> > l_rotate270() {
	vector<vector<int> > temp;
	temp = p;
	for (int i = 0; i < m; i++) 
		for (int j = 0; j < m; j++) 
			temp[i][j] = p[m-j-1][i];
	return temp;
}

bool check(vector<vector<int> > p_temp) {
	int x = 0, y = 0;
	bool flag = false,res = false;
	for (int i = 0; i < n - m; i++) {
		for (int j = 0; j < n - m; j++) {
			flag = false;
			for (int k = 0; k < m; k++) {
				for (int l = 0; l < m; l++) {
					if (p_temp[k][l] == -1)continue;
					if (field[i + k][j + l] == p_temp[k][l]) {
						flag = true;
					}
					else {
						if (flag) {
							flag = false;
							break;
						}
					}				
				}
				if (!flag)break;
			}
			if (flag) {
				bool f = false;
				int add_x = 0,add_y = 0;
				for (int k = 0; k < m; k++) {
					for (int l = 0; l < m; l++) {
						if (p_temp[k][l] != -1) {
							add_x = l, add_y = k;
							f = true;
							break;
						}
					}
					if (f)break;
				}
				cout << i + 1+add_x << " " << j + 1 + add_y << endl;
				return 1;
			}
		}
	}
	return 0;
}