// Cutiepie is a hoe!
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
#include <bits/stdc++.h>
using namespace std;

#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

#define rep(i, a) for(int i = 0; i < (a); ++i)
#define repp(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;

int a[1005][1005];
int ee[3][1005];
ll s[1005];
ll s2[1005];

void solve()
{
  int n, k;
  cin>>n>>k;
  rep(i, k){
    s[i] = 0;
    rep(j, n)
    {
      cin>>a[i][j];
      s[i] += 1LL*a[i][j];
      s2[i] += 1LL*a[i][j]*a[i][j];
    }
  }
  fflush(stdout);
  int kk = 1;
  ll change, vdif;
  if(2*s[1] == s[0]+s[2]){
    vdif = s[1]-s[0];
  }else{
    vdif = s[k-1]-s[k-2];
  }
  repp(i, 1, k)
  {
    if(vdif != s[i]-s[i-1]){
      change = s[i]-s[i-1]-vdif;
      kk = i;
      break;
    }
  }
  ll v2;
  if(kk<=2){
    v2 = s2[k-1]+s2[k-3]-2LL*s2[k-2];
  }else{
    v2 = s2[2]+s2[0]-2LL*s2[1];
  }
  ll v2_ = s2[kk+1]+s2[kk-1]-2LL*s2[kk];
  rep(i, n)
  {
    ll x = a[kk][i];
    ll y = x - change;
    ll v2__ = v2_ + 2LL*x*x - 2LL*y*y;
    if(v2 == v2__){
      cout<<kk<<" "<<y<<endl;
      fflush(stdout);
      return;
    }
  }
}

int main() {
  cin.sync_with_stdio(0); cin.tie(0);
  cin.exceptions(cin.failbit);
  solve();
  return 0;
}

