#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexedset;
//int randi = (mt19937(null));
ll stepen(ll x){
    ll res = 1;
    while(x % 2 == 0){
        x /= 2;
        res++;
    }
    return res;
}
vector<pair<int, int>> ZapisiTacke(int n){
    vector<pair<int, int>>res(n + 1);
    ll dva = 1;
    ll brst = 1;
    while(dva < n){
        brst++;
        dva*=2;
    }
    brst--;
    ll velicina = 1000;
    ll dole = dva / 2;
    ll brojac;
    brojac = (dole/2)*(-1000) + 500;
    res[n] = make_pair(0, -100000008);
    for(int j = dole; j < n; j++){
        res[j] = make_pair(brojac, 0);
        brojac += 1000;
    }
    brojac = (dole/2)*(-1000) + 500;
    for(int i = dole; i < 2*dole; i++){
        ll naj = stepen(i - dole + 1);
        res[i / (pow(2, naj))] = make_pair((((brojac + 500) * (brst - naj)) /brst), naj*velicina);
        brojac += 1000;
    }
    /*for(auto x : res){
        cout << x.first << " " << x.second << "   ";
    }
    cout << endl;*/
    return res;
}
vector<int> Resi(int n, int Q){
    vector<int>imamo(n);
    for(int i = 0; i < n; i++){
        imamo[i] = i + 1;
    }
    vector<int>brnivo(stepen(n));
    int n1 = n;
    for(int i = 0; i < n; i++){
        int gaga = pow(2, i);
        brnivo[i] = min(gaga, n1);
        n1 -= brnivo[i];
    }
    int poslednji;
    vector<vector<int>>nivo(brnivo.size());
    while(imamo.size() > 4){
        int rand1 = (rand() + 6767) % imamo.size();
        int rand2 = (rand() + 676767) % imamo.size();
        int rand3 = (rand() + 7676) % imamo.size();
        if(rand1 == rand2){
            rand2++;
        }
        if(rand1 == rand3){
            rand3++;
        }
        if(rand2 == rand3){
            rand3++;
        }
        int odg = Pitaj(rand1, rand2, rand3);
        if(odg == 0){
            int nula = 0, minus1 = 0, plus1 = 0;
            vector<int>tu;
            tu.push_back(rand1);
            tu.push_back(rand3);
            for(int i = 0; i < imamo.size(); i++){
                if(i != rand1 and i != rand2){
                    odg = Pitaj(rand1, rand2, imamo[i]);
                    if(odg == 0){
                        nula++;
                        tu.push_back(imamo[i]);
                    }
                    else if(odg == -1){
                        minus1++;
                    }
                    else{
                        plus1++;
                    }
                }
            }
            sort(tu.begin(), tu.end());
            ll istih = 0;
            ll gore = 0;
            for(int i = 0; i < brnivo.size(); i++){
                if(brnivo[i] == nula and (gore == minus1 or gore == plus1)){
                    for(int j = 0; j < tu.size(); j++){
                        nivo[i].push_back(tu[j]);
                    }
                }
                gore += brnivo[i];
            }
            vector<int>novi;
            for(int i = 0; i < imamo.size(); i++){
                if(!binary_search(tu.begin(), tu.end(), imamo[i])){
                    novi.push_back(imamo[i]);
                }
            }
            imamo = novi;
        }

    }
    for(int i = 0; i < brnivo.size(); i++){
        for(auto x : nivo[i]){
            cout << x << " ";
        }
        cout << endl;
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<pair<int, int>>a = ZapisiTacke(n);
}