#include <bits/stdc++.h>
using namespace std;
int tot, ch[2009][2], size[2009], lef[2009][2], fa[2009], sum, n, nwnw, root,
    nw;
bool vis[2009];
inline bool ge(int x) { return ch[fa[x]][1] == x; }
inline char ask(int x, int y, int z) {
  printf("%d %d %d\n", x, y, z);
  fflush(stdout);
  char s[1];
  scanf("%s", s);
  return s[0];
}
inline void getroot(int u, int gr) {
  size[u] = u <= n;
  int nw = 0;
  if (fa[u] && !vis[fa[u]] && gr != fa[u])
    getroot(fa[u], u), size[u] += size[fa[u]], nw = max(nw, size[fa[u]]);
  if (ch[u][0] && !vis[ch[u][0]] && gr != ch[u][0])
    getroot(ch[u][0], u), size[u] += size[ch[u][0]],
        nw = max(nw, size[ch[u][0]]);
  if (ch[u][1] && !vis[ch[u][1]] && gr != ch[u][1])
    getroot(ch[u][1], u), size[u] += size[ch[u][1]],
        nw = max(nw, size[ch[u][1]]);
  nw = max(nw, sum - nw);
  if (u > n && nw < nwnw) nwnw = nw, root = u;
}
inline void getsize(int u, int gr) {
  size[u] = u <= n;
  if (fa[u] && !vis[fa[u]] && gr != fa[u])
    getsize(fa[u], u), size[u] += size[fa[u]];
  if (ch[u][0] && !vis[ch[u][0]] && gr != ch[u][0])
    getsize(ch[u][0], u), size[u] += size[ch[u][0]];
  if (ch[u][1] && !vis[ch[u][1]] && gr != ch[u][1])
    getsize(ch[u][1], u), size[u] += size[ch[u][1]];
}
void solve(int u, int id) {
  if (!ch[u][0] && !ch[u][1]) {
    ++tot;
    ch[fa[u]][ge(u)] = tot;
    fa[tot] = fa[u];
    ch[tot][0] = lef[tot][0] = u;
    ch[tot][1] = lef[tot][1] = id;
    fa[u] = fa[id] = tot;
    return;
  }
  root = 2001;
  nwnw = 2001;
  getroot(u, 0);
  getsize(root, 0);
  int now = root;
  vis[now] = 1;
  char c = ask(lef[now][0], lef[now][1], id);
  if (c == 'X') {
    if (fa[now]) {
      if (vis[fa[now]]) {
        ++tot;
        ch[fa[now]][ge(now)] = tot;
        ch[tot][0] = now;
        ch[tot][1] = id;
        fa[tot] = fa[now];
        lef[tot][0] = lef[now][0];
        lef[tot][1] = id;
        fa[id] = fa[now] = tot;
      } else {
        sum = size[fa[now]];
        solve(fa[now], id);
      }
    } else {
      ++tot;
      ch[tot][0] = now;
      ch[tot][1] = id;
      lef[tot][0] = lef[now][0];
      lef[tot][1] = id;
      fa[now] = fa[id] = tot;
    }
  } else {
    int tg = c == 'Y' ? 1 : 0;
    if (vis[ch[now][tg]]) {
      ++tot;
      ch[tot][0] = ch[now][tg];
      ch[tot][1] = id;
      lef[tot][0] = lef[ch[now][tg]][0];
      lef[tot][1] = id;
      fa[ch[now][tg]] = fa[id] = tot;
      fa[tot] = now;
      ch[now][tg] = tot;
    } else {
      sum = size[ch[now][tg]];
      solve(ch[now][tg], id);
    }
  }
}
int main() {
  scanf("%d", &n);
  tot = n;
  ++tot;
  ch[tot][0] = lef[tot][0] = 1;
  ch[tot][1] = lef[tot][1] = 2;
  fa[1] = fa[2] = tot;
  for (int i = 1; i <= n; ++i) lef[i][0] = i;
  for (int i = 3; i <= n; ++i) {
    memset(vis, 0, sizeof(vis));
    sum = i - 1;
    solve(tot, i);
  }
  puts("-1");
  for (int i = 1; i <= tot; ++i) {
    if (!fa[i]) fa[i] = -1;
    printf("%d ", fa[i]);
  }
  return 0;
}
