#include <bits/stdc++.h>
#pragma GCC optimize("O2,Ofast,inline,unroll-all-loops,-ffast-math")
#pragma GCC target("avx,sse2,sse3,sse4,popcnt")
using namespace std;
template <class T>
inline void in(T &x) {
  x = 0;
  char c = getchar();
  bool f = 0;
  while (!isdigit(c)) f |= (c == '-'), c = getchar();
  while (isdigit(c)) x = x * 10 + (c ^ '0'), c = getchar();
  f ? x = -x : 0;
}
template <class T>
inline void out(T x, const char c = '\n') {
  static short st[30];
  short m = 0;
  if (x < 0) putchar('-'), x = -x;
  do st[++m] = x % 10, x /= 10;
  while (x);
  while (m) putchar(st[m--] | '0');
  putchar(c);
}
template <class T>
inline void err(const T &x, const char c = '\n') {
  cerr << x << c;
}
template <class T, class... Args>
inline void in(T &x, Args &...args) {
  in(x);
  in(args...);
}
template <class T, class... Args>
inline void out(const T &x, const Args &...args) {
  out(x, ' ');
  out(args...);
}
template <class T, class... Args>
inline void err(const T &x, const Args &...args) {
  err(x, ' ');
  err(args...);
}
template <class T>
inline void prt(T a[], int n) {
  for (register int i = 0; i < n; ++i) out(a[i], i == n - 1 ? '\n' : ' ');
}
template <class T>
inline void clr(T a[], int n) {
  memset(a, 0, sizeof(T) * n);
}
template <class T>
inline void clr(T *a, T *b) {
  memset(a, 0, sizeof(T) * (b - a));
}
template <class T>
inline bool ckmax(T &a, const T &b) {
  return a < b ? a = b, 1 : 0;
}
template <class T>
inline bool ckmin(T &a, const T &b) {
  return a > b ? a = b, 1 : 0;
}
namespace i207M {
const int inf = 1e9;
int ch[2005][3];
bool del[2005];
int all, mnsz, pot;
int sz[2005];
void getrt(int x, int _fa) {
  sz[x] = 1;
  int t = 0;
  for (register int i = 0; i < 3; ++i)
    if (ch[x][i] && ch[x][i] != _fa && !del[ch[x][i]]) {
      getrt(ch[x][i], x);
      sz[x] += sz[ch[x][i]];
      ckmax(t, sz[ch[x][i]]);
    }
  ckmax(t, all - sz[x]);
  if (ckmin(mnsz, t)) pot = x;
}
int getsz(int x, int _fa) {
  int t = 1;
  for (register int i = 0; i < 3; ++i)
    if (ch[x][i] && ch[x][i] != _fa && !del[ch[x][i]]) t += getsz(ch[x][i], x);
  return t;
}
inline int query(int x, int y, int z) {
  cout << x << ' ' << y << ' ' << z << endl;
  string s;
  cin >> s;
  return s == "X" ? 1 : (s == "Y" ? 2 : 3);
}
int rt, tot;
inline void newnode(int x, int id) {
  int y = ch[x][2];
  if (!y) {
    ch[x][2] = ch[id][2] = ++tot, ch[tot][0] = x, ch[tot][1] = id;
    rt = tot;
  } else {
    ch[y][ch[y][1] == x] = ++tot, ch[tot][2] = y;
    ch[x][2] = ch[id][2] = tot, ch[tot][0] = x, ch[tot][1] = id;
  }
}
inline int getid(int x) {
  while (ch[x][0]) x = ch[x][0];
  return x;
}
void solve(int x, int id) {
  all = getsz(x, 0);
  if (del[x] || !ch[x][0]) return newnode(x, id);
  mnsz = inf;
  getrt(x, 0);
  x = pot;
  if (!ch[x][0]) x = ch[x][2];
  del[x] = 1;
  int t = query(getid(ch[x][0]), getid(ch[x][1]), id);
  if (t == 1)
    return (!ch[x][2] || del[ch[x][2]]) ? newnode(x, id) : solve(ch[x][2], id);
  if (t == 2) return solve(ch[x][1], id);
  return solve(ch[x][0], id);
}
int n;
signed main() {
  cin >> n;
  tot = n;
  ch[1][2] = ch[2][2] = ++tot, ch[tot][0] = 1, ch[tot][1] = 2;
  rt = tot;
  for (register int i = 3; i <= n; ++i) {
    memset(del, 0, sizeof(del));
    solve(rt, i);
  }
  cout << -1 << endl;
  for (register int i = 1; i <= tot; ++i)
    cout << (ch[i][2] ? ch[i][2] : -1) << ' ';
  cout << endl;
  return 0;
}
}  // namespace i207M
signed main() {
  i207M::main();
  return 0;
}
