#include <bits/stdc++.h>
using namespace std;
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
template <class T>
std::ostream& operator<<(std::ostream& os, const std::vector<T>& input) {
  for (auto const& i : input) {
    os << i << " ";
  }
  return os;
}
template <class T1, class T2>
std::ostream& operator<<(std::ostream& os, const std::pair<T1, T2>& input) {
  os << "(" << input.first << ", " << input.second << ')';
  return os;
}
double startTime;
double getCurrentTime() {
  return ((double)clock() - startTime) / CLOCKS_PER_SEC;
}
const int maxn = 50;
void pre() {}
void solve() {
  int n;
  cin >> n;
  int k = 1;
  int ans = 0;
  for (int i = 2; i < int(n + 1); ++i) {
    int tmp = (n / i - 1) * (i - 1);
    if (n % i) tmp += n % i - 1;
    if (tmp > ans) {
      ans = tmp;
      k = i;
    }
  }
  set<int> cand;
  cand.clear();
  for (int i = 0; i < int(n); ++i)
    if (i % k) cand.insert(i);
  int cnt = 0;
  while (cnt < ans) {
    cout << k;
    for (int i = 0; i < int(k); ++i) {
      auto it = cand.begin();
      cout << " " << (*it + 1);
      cand.erase(it);
      cnt++;
    }
    cout << endl;
    int x;
    cin >> x;
    x--;
    for (int i = 0; i < int(k); ++i) {
      int y = (x + i) % n;
      if (y % k) {
        if (cand.find(y) == cand.end()) {
          cnt--;
          cand.insert(y);
        }
      }
    }
  }
  cout << 0 << endl;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  int cas = 1;
  pre();
  for (int ca = 0; ca < int(cas); ++ca) solve();
  return 0;
}
