#include <bits/stdc++.h>
using namespace std;
const int maxn = 5005;
vector<int> go[maxn], lis;
bool vis[maxn];
int fa[maxn], siz[maxn], mx[maxn], n, cn, lef, root;
void dfs(int now, int pre) {
  if (now > cn) lis.push_back(now);
  siz[now] = (now <= cn);
  mx[now] = 0;
  for (auto p : go[now])
    if (p != pre && !vis[p])
      dfs(p, now), siz[now] += siz[p], mx[now] = max(mx[now], siz[p]);
}
int get_leaf(int now) {
  if (now <= cn) return now;
  return get_leaf(go[now][0] == fa[now] ? go[now][1] : go[now][0]);
}
int query(int x, int y, int z) {
  cout << x << " " << y << " " << z << endl;
  fflush(stdout);
  string s;
  cin >> s;
  if (s == "X") return 0;
  if (s == "Y") return 1;
  return 2;
}
void push(int now) {
  lis.clear();
  dfs(now, 0);
  int cen = 0;
  for (auto p : lis)
    if (siz[p] * 2 >= siz[now] && mx[p] * 2 <= siz[now]) cen = p;
  if (!cen) cen = now;
  vector<int> ch, leaf;
  ch.clear(), leaf.clear();
  for (auto p : go[cen])
    if (p != fa[cen]) ch.push_back(p), leaf.push_back(get_leaf(p));
  if (ch.size() < 2) {
    fa[++n] = fa[cen];
    fa[cen] = fa[lef] = n;
    return;
  }
  int bel = query(leaf[0], lef, leaf[1]);
  vis[cen] = 1;
  if (bel == 2) {
    if (fa[cen] != -1 && !vis[fa[cen]])
      push(fa[cen]);
    else {
      fa[++n] = fa[cen];
      fa[cen] = fa[lef] = n;
    }
  } else {
    if (vis[ch[bel]]) {
      fa[++n] = cen;
      fa[ch[bel]] = fa[lef] = n;
    } else
      push(ch[bel]);
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin >> n;
  fa[1] = -1;
  cn = n;
  for (lef = 2; lef <= cn; lef++) {
    for (int i = 1; i <= n; i++) vis[i] = 0, go[i].clear();
    for (int i = 1; i < lef; i++)
      if (fa[i] == -1)
        root = i;
      else
        go[fa[i]].push_back(i), go[i].push_back(fa[i]);
    for (int i = cn + 1; i <= n; i++)
      if (fa[i] == -1)
        root = i;
      else
        go[fa[i]].push_back(i), go[i].push_back(fa[i]);
    push(root);
  }
  cout << "-1" << endl;
  for (int i = 1; i <= n; i++) cout << fa[i] << " ";
  cout << endl;
  fflush(stdout);
  return 0;
}
