#include <bits/stdc++.h>
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
using namespace std;
namespace ywy {
int ch[2111][2], fa[2111], gpt = 1, size[2111];
unsigned char bv[2111];
int tot = 0, zx;
void afs(int pt) {
  if (bv[pt] || !pt) return;
  tot++;
  if (!ch[pt][0] && !ch[pt][1]) {
    return;
  }
  afs(ch[pt][0]);
  afs(ch[pt][1]);
}
int minn = 1234567890;
void bfs(int pt) {
  if (bv[pt] || !pt) return;
  int mx = 0;
  if (!ch[pt][0] && !ch[pt][1])
    size[pt] = 1;
  else {
    size[pt] = 1;
    for (register int i = 0; i <= 1; i++) {
      if (bv[ch[pt][i]]) continue;
      bfs(ch[pt][i]);
      size[pt] += size[ch[pt][i]];
      mx = max(mx, size[ch[pt][i]]);
    }
    if (max(mx, tot - size[pt]) < minn) zx = pt, minn = max(mx, tot - size[pt]);
  }
}
void digui(int pt, int me) {
  if (bv[pt] || (!ch[pt][0] && !ch[pt][1])) {
    int cjr = gpt;
    gpt++;
    ch[fa[pt]][(pt == ch[fa[pt]][1])] = cjr;
    fa[cjr] = fa[pt];
    fa[me] = cjr;
    fa[pt] = cjr;
    ch[cjr][0] = me;
    ch[cjr][1] = pt;
    return;
  }
  tot = 0;
  afs(pt);
  minn = 1234567890;
  bfs(pt);
  int lef = zx;
  while (ch[lef][0]) lef = ch[lef][0];
  int rgh = zx;
  while (ch[rgh][1]) rgh = ch[rgh][1];
  printf("%d %d %d\n", lef, rgh, me);
  fflush(stdout);
  char c;
  cin >> c;
  bv[zx] = 1;
  if (c == 'Z') {
    digui(ch[zx][0], me);
    return;
  }
  if (c == 'Y') {
    digui(ch[zx][1], me);
    return;
  }
  if (c == 'X') {
    if (bv[fa[zx]] || !fa[zx]) {
      int cjr = gpt;
      gpt++;
      fa[cjr] = fa[zx];
      ch[fa[zx]][(zx == ch[fa[zx]][1])] = cjr;
      ch[cjr][0] = zx;
      ch[cjr][1] = me;
      fa[zx] = cjr;
      fa[me] = cjr;
      return;
    }
    int cur = fa[zx];
    while (!bv[fa[cur]] && fa[cur]) cur = fa[cur];
    digui(cur, me);
  }
}
void ywymain() {
  int n;
  cin >> n;
  gpt = n + 2;
  ch[n + 1][0] = 1;
  ch[n + 1][1] = 2;
  fa[1] = fa[2] = n + 1;
  for (register int i = 3; i <= n; i++) {
    memset(bv, 0, sizeof(bv));
    int cur = 1;
    while (fa[cur]) cur = fa[cur];
    digui(cur, i);
  }
  printf("-1\n");
  fflush(stdout);
  for (register int i = 1; i <= n * 2 - 1; i++) {
    if (!fa[i])
      printf("-1 ");
    else
      printf("%d ", fa[i]);
  }
  cout << endl;
  fflush(stdout);
}
}  // namespace ywy
int main() {
  ywy::ywymain();
  return (0);
}
