#include <iostream>
#include <vector>
#include "code.h"

using namespace std;

const int N = 205;
int mat[N][N];
int grt[N];

bool cs1()
{
  return false;
}
vector<pair<int, int>> ZapisiTacke(int n)
{
  vector<pair<int, int>> t(n+1);
  t[1] = make_pair(0, 0);
  for(int i = 2; i <= n; i++)
  {
    t[i] = make_pair(5, i);
  }
  return t;
}
vector<int> Resi(int n, int q)
{
    vector<int> ans(n+1);
    if(cs1())
    {
      return ans;
    }
    if(n > 200) return ans;

    int a = Pitaj(1, 2, 3);
    int nxt = 0;
    if(a == 0)
    {
      for(int i = 4; i<= n; i++)
      {
        if(Pitaj(1, 2, i) != 0) { nxt = i; break; }
      }
    }
    else
    {
      int b = Pitaj(1, 2, 4);
      int c = Pitaj(1, 3, 4);
      int d = Pitaj(2, 3, 4);

      if(b == 0) nxt = 3;
      else if(c == 0) nxt = 2;
      else nxt = 1;
    }

    for(int i = 1; i <= n; i++)
    {
      for(int j = i + 1; j <= n; j++)
      {
        if(i == nxt || j == nxt) continue;
        mat[i][j] = Pitaj(nxt, i, j);
        mat[j][i] = -mat[i][j];
        if(mat[i][j] > 0) grt[j]++;
        else grt[i]++;
      }
    }

    for(int i = 1; i <= n; i++)
    {
      if(i == nxt) continue;
      ans[i] = grt[i] + 2;
    }
    ans[nxt] = 1;
    return ans;
}