#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define pre(i,a,b) for(int i=a;i>=b;i--)
#define N 1005
#define int long long
using namespace std;
int n, m, a[N][N], f[N], g[N];
signed main(){
	scanf("%lld%lld", &m, &n);
	rep(i, 1, n)rep(j, 1, m)
		scanf("%lld", &a[i][j]), 
		f[i] += a[i][j], 
		g[i] += a[i][j] * a[i][j];
	int sp = 0, cen = 0;
	rep(i, 1, n - 2)if(f[i] + f[i + 2] == 2 * f[i + 1])
		{sp = f[i + 1] - f[i], cen = i + 1; break;}
	int mom = 0, sig = 0;
	rep(i, 1, n)if(f[i] - f[cen] != sp * (i - cen)){mom = i;break;}
	if(mom <= 3)sig = g[mom + 1] + g[mom + 3] - 2 * g[mom + 2];
	else sig = g[mom - 3] + g[mom - 1] - 2 * g[mom - 2];
	int dta = f[cen] + sp * (mom - cen) - f[mom], ed;
	if(mom <= 3)ed = 2 * g[mom + 1] - g[mom + 2] + sig;
	else ed = 2 * g[mom - 1] - g[mom - 2] + sig;
	rep(i, 1, m){
		if(ed == g[mom] - a[mom][i] * a[mom][i] + (a[mom][i] + dta) * (a[mom][i] + dta)){
			printf("%lld %lld\n",mom - 1, a[mom][i] + dta);
			return 0;
		}
	}
	puts("No Solution ! ! !");
	return 0;
}
