#include <bits/stdc++.h>
using namespace std;
const int Maxn = 1010;
const int inf = 1 << 23;
int ch[Maxn << 1][3], siz[Maxn << 1], maxs[Maxn << 1], alls, core;
bool vis[Maxn << 1];
int n, tot, T;
void dfs(int x, int fa) {
  siz[x] = 1;
  maxs[x] = 0;
  for (int i = 0; i < 3; i++) {
    int y = ch[x][i];
    if (y == fa || !y || vis[y]) continue;
    dfs(y, x);
    if (maxs[x] < siz[y]) maxs[x] = siz[y];
    siz[x] += siz[y];
  }
  if (maxs[x] < alls - siz[x]) maxs[x] = alls - siz[x];
  if (maxs[x] < maxs[core] || (maxs[x] == maxs[core] && x > core)) core = x;
}
void dfs2(int x, int fa) {
  siz[x] = 1;
  for (int i = 0; i < 3; i++) {
    int y = ch[x][i];
    if (y == fa || !y || vis[y]) continue;
    dfs(y, x);
    siz[x] += siz[y];
  }
}
int getl(int x) { return x <= n ? x : getl(ch[x][1]); }
void solve(int x) {
  vis[x] = true;
  if (x <= n) {
    tot++;
    int fa = ch[x][0];
    if (ch[fa][1] == x)
      ch[fa][1] = tot;
    else
      ch[fa][2] = tot;
    ch[tot][0] = fa;
    ch[x][0] = tot;
    ch[tot][1] = x;
    ch[tot][2] = T;
    ch[T][0] = tot;
    return;
  }
  int l1 = getl(ch[x][1]), l2 = getl(ch[x][2]);
  cout << l1 << " " << l2 << " " << T << endl;
  char c;
  cin >> c;
  if (c == 'X') {
    if (vis[ch[x][0]] || !ch[x][0]) {
      tot++;
      int fa = ch[x][0];
      if (fa) {
        if (ch[fa][1] == x)
          ch[fa][1] = tot;
        else
          ch[fa][2] = tot;
      }
      ch[tot][0] = fa;
      ch[x][0] = tot;
      ch[tot][1] = x;
      ch[tot][2] = T;
      ch[T][0] = tot;
      return;
    }
    dfs2(ch[x][0], x);
    alls = siz[ch[x][0]];
    core = 0;
    dfs(ch[x][0], x);
    solve(core);
  } else if (c == 'Y') {
    if (vis[ch[x][2]]) {
      tot++;
      ch[tot][0] = x;
      ch[tot][1] = ch[x][2];
      ch[tot][2] = T;
      ch[ch[x][2]][0] = tot;
      ch[x][2] = tot;
      ch[T][0] = tot;
      return;
    }
    dfs2(ch[x][2], x);
    alls = siz[ch[x][2]];
    core = 0;
    dfs(ch[x][2], x);
    solve(core);
  } else {
    if (vis[ch[x][1]]) {
      tot++;
      ch[tot][0] = x;
      ch[tot][1] = ch[x][1];
      ch[tot][2] = T;
      ch[ch[x][1]][0] = tot;
      ch[x][1] = tot;
      ch[T][0] = tot;
      return;
    }
    dfs2(ch[x][1], x);
    alls = siz[ch[x][1]];
    core = 0;
    dfs(ch[x][1], x);
    solve(core);
  }
}
int main() {
  int i, j, k;
  cin >> n;
  tot = n;
  ch[1][0] = ch[2][0] = ++tot;
  ch[tot][1] = 1;
  ch[tot][2] = 2;
  maxs[0] = inf;
  for (T = 3; T <= n; T++) {
    memset(vis, false, sizeof(vis));
    alls = 2 * T - 3;
    core = 0;
    dfs(1, 0);
    solve(core);
  }
  cout << "-1" << endl;
  for (i = 1; i <= tot; i++) {
    if (!ch[i][0])
      cout << "-1 ";
    else
      cout << ch[i][0] << " ";
  }
  cout << endl;
  return 0;
}
