#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a),i##ss=(b);i<=i##ss;i++)
#define dwn(i,a,b) for(int i=(a),i##ss=(b);i>=i##ss;i--)
#define deb(x) cerr<<(#x)<<":"<<(x)<<'\n'
#define pb push_back
#define fi first
#define se second
#define hvie '\n'
using namespace std;
typedef pair<int,int> pii;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
int yh(){
	int ret=0;bool f=0;char c=getchar();
	while(!isdigit(c)){if(c==EOF)return -1;if(c=='-')f=1;c=getchar();}
	while(isdigit(c))ret=(ret<<3)+(ret<<1)+(c^48),c=getchar();
	return f?-ret:ret;
}
const int maxn=1005;
int m,k;
int x[maxn][maxn];
ll s1[maxn],s2[maxn];
ll sumv2;
void calc(ll mid){
	sumv2=s2[mid-1]+s2[mid+1]-2ll*s2[mid];
}
int main(){
	m=yh(),k=yh();
	rep(i,0,k-1){
		rep(j,0,m-1) x[i][j]=yh(),s1[i]+=x[i][j],s2[i]+=x[i][j]*x[i][j];
	}
	int wa;vector<int>w;
	rep(i,1,k-2){
		if(s1[i]-s1[i-1]!=s1[i+1]-s1[i]){
			w.pb(i);
		}
	}
	if(w.size()==3) wa=w[1];
	else if(w[0]==1) wa=1;
	else {assert(w[1]==k-2);wa=k-2;}
	if(wa<k/2){
		calc(k-2);
	}
	else calc(1);
	// cout<<sumv2<<hvie;
	cout<<wa<<' ';
	// cout<<"\n-----------------\n";
	rep(j,0,m-1){
		//assume that x[wa][j] is wrong
		s1[wa]-=x[wa][j]; s2[wa]-=x[wa][j]*x[wa][j];
		ll a=(s1[wa-1]+s1[wa+1])/2ll-s1[wa];
		// cout<<j<<" ? "<<a<<hvie;
		if(2ll*(s2[wa]+a*a)+sumv2==s2[wa-1]+s2[wa+1]) {
			cout<<a<<hvie;
			break;
		}
		s1[wa]+=x[wa][j]; s2[wa]+=x[wa][j]*x[wa][j];
	}
	return 0;
}
