#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MX = 200005;

// Galois field 2^e (1 <= e <= 30)
constexpr int pps[] = {1,0b11,0b111,0b1011,0b10011,0b100101,0b1000011,0b10000011,0b100011101,0b1000010001,0b10000001001,0b100000000101,0b1000001010011,0b10000000011011,0b100010001000011,0b1000000000000011,0b10001000000001011,0b100000000000001001,0b1000000000010000001,0b10000000000000100111,0b100000000000000001001,0b1000000000000000000101,0b10000000000000000000011,0b100000000000000000100001,0b1000000000000000010000111,0b10000000000000000000001001,0b100000000000000000001000111,0b1000000000000000000000100111,0b10000000000000000000000001001,0b100000000000000000000000000101,0b1000000100000000000000000000111};
// inline int bsr(uint x) { return 31^__builtin_clz(x);}
inline int bsr(ull x) { return 63^__builtin_clzll(x);}
template<int e>
struct GF2 {
  typedef ll Int;
  const static int q = 1<<e;
  const static Int pp = pps[e];
  Int x;
  GF2(Int x=0) {
    int k = bsr(x);
    if (k >= e) {
      for (Int b = 1ll<<k, p = pp<<(k-e); p >= pp; b >>= 1, p >>= 1) {
        if (x&b) x ^= p;
      }
    }
    this->x = x;
  }
  GF2& operator+=(const GF2& a) { x ^= a.x; return *this;}
  GF2 operator+(const GF2& a) const { return GF2(*this) += a;}
  GF2 operator*(const GF2& a) const {
    Int s = 0;
    for (Int b = a.x, p = x; b; b >>= 1, p <<= 1) if (b&1) s ^= p;
    return GF2(s);
  }
  GF2& operator*=(const GF2& a) { return *this = *this * a;}
  GF2& operator/=(const GF2& a) { return *this *= a.pow(q-2);}
  GF2 operator/(const GF2& a) const { return *this * a.pow(q-2);}
  GF2 pow(int t) const {
    if (!t) return 1;
    GF2 r = pow(t>>1);
    r *= r;
    if (t&1) r *= *this;
    return r;
  }
  bool operator==(const GF2& a) const { return x == a.x;}
  bool operator<(const GF2& a) const { return x < a.x;} // for convenient
};
typedef GF2<5> F;

int main() {
  int q = F::q;
  int k = q+1, n = 1 + q + q*q;
  vvi ans;
  {
    vi now(1,0);
    rep(i,q) now.eb(1+i);
    ans.eb(now);
  }
  auto f = [&](F a, F b) { return 1 + q + a.x*q+b.x;};
  rep(i,q) {
    vi now(1,0);
    rep(j,q) now.pb(f(i,j));
    ans.eb(now);
  }
  rep(i,q)rep(j,q) {
    vi now(1,1+i);
    rep(k,q) {
      now.pb(f(k,F(i)*k+j));
    }
    ans.pb(now);
  }

  rep(i,n)rep(j,i) {
    vi a(ans[i]);
    a.insert(a.end(),rng(ans[j]));
    sort(rng(a)); uni(a);
    assert(sz(a) == k*2-1);
  }

  cout<<n<<" "<<k<<endl;
  rep(i,n) {
    rep(j,k) ans[i][j]++;
    cout<<ans[i]<<endl;
  }
  return 0;
}






















Measured memory_bytes: 512