#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
template <class T>
inline void amin(T &x, const T &y) {
  if (y < x) x = y;
}
template <class T>
inline void amax(T &x, const T &y) {
  if (x < y) x = y;
}
template <class Iter>
void rprintf(const char *fmt, Iter begin, Iter end) {
  for (bool sp = 0; begin != end; ++begin) {
    if (sp)
      putchar(' ');
    else
      sp = true;
    printf(fmt, *begin);
  }
  putchar('\n');
}
int N;
int dp[2011];
int prv[2011];
bool tar[1011];
bool cur[1011];
int calc(int a) {
  memset(dp, 0xc0, sizeof dp);
  dp[0] = 0;
  for (int i = 0, i_len = (N); i < i_len; ++i) {
    for (int j = 1; j < a; j++) {
      if (dp[i + j + 1] < dp[i] + j) {
        dp[i + j + 1] = dp[i] + j;
        prv[i + j + 1] = i;
      }
    }
  }
  return dp[N] - a + 1;
}
void query(vector<int> v) {
  printf("%d", (int)v.size());
  for (int i = 0, i_len = (v.size()); i < i_len; ++i) printf(" %d", v[i] + 1);
  printf("\n");
  fflush(stdout);
  for (__typeof((v).begin()) e = (v).begin(), e_end = (v).end(); e != e_end;
       ++e)
    cur[*e] = true;
  int x;
  scanf("%d", &x);
  x--;
  for (int i = 0, i_len = (v.size()); i < i_len; ++i) cur[(x + i) % N] = false;
}
void solve() {
  int ma = 0, a = 0;
  for (int b = 1; b < N; b++) {
    int tmp = calc(b);
    if (ma < tmp) {
      ma = tmp;
      a = b;
    }
  }
  if (ma == 0) {
    puts("0");
    fflush(stdout);
  } else {
    calc(a);
    int x = N;
    memset(tar, 0, sizeof tar);
    memset(cur, 0, sizeof cur);
    while (x) {
      for (int k = prv[x]; k < x - 1; k++) tar[k] = true;
      x = prv[x];
    }
    while (1) {
      vector<int> v;
      for (int i = 0, i_len = (N); i < i_len; ++i)
        if (tar[i] && !cur[i]) {
          v.push_back(i);
        }
      if ((int)v.size() <= a) {
        for (int i = 0, i_len = (N); i < i_len; ++i)
          if (tar[i] && cur[i]) {
            if ((int)v.size() == a) break;
            v.push_back(i);
          }
        query(v);
        break;
      } else {
        v.resize(a);
        query(v);
      }
    }
    puts("0");
    fflush(stdout);
  }
}
void MAIN() {
  scanf("%d", &N);
  solve();
}
int main() {
  int TC = 1;
  for (int tc = 0, tc_len = (TC); tc < tc_len; ++tc) MAIN();
  return 0;
}
