#include <bits/stdc++.h>
#pragma GCC optimize("O2,Ofast,inline,unroll-all-loops,-ffast-math")
#pragma GCC target("popcnt")
using namespace std;
int sz[2010], fa[2010], ls[2010], rs[2010], lc[2010], rc[2010], n, cnt = 1;
bool vis[2010];
template <class T>
void read(T &x) {
  char ch = x = 0;
  bool fl = false;
  while (!isdigit(ch)) fl |= ch == '-', ch = getchar();
  while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
  x = fl ? -x : x;
}
int query(int x, int y, int z) {
  cout << x << " " << y << " " << z << endl;
  string s;
  cin >> s;
  return s[0] - 'X' + 1;
}
void getsize(int x, int par, int &tot) {
  int a[3] = {fa[x], ls[x], rs[x]};
  sz[x] = x <= n, tot++;
  for (int i = 0; i < 3; i++) {
    if (a[i] && !vis[a[i]] && a[i] != par)
      getsize(a[i], x, tot), sz[x] += sz[a[i]];
  }
}
void getroot(int x, int par, int sum, int &root, int &root_size) {
  int a[3] = {fa[x], ls[x], rs[x]}, tmp_size = 0;
  for (int i = 0; i < 3; i++) {
    if (a[i] && !vis[a[i]] && a[i] != par) {
      getroot(a[i], x, sum, root, root_size);
      tmp_size = max(tmp_size, sz[a[i]]);
    }
  }
  tmp_size = max(tmp_size, sum - sz[x]);
  if (tmp_size < root_size && x > n) root = x, root_size = tmp_size;
}
void solve(int x) {
  int tot = 0, root = 0, root_size = n;
  getsize(x, 0, tot);
  if (tot == 1) {
    int u = cnt, v = n - 1 + cnt;
    if (ls[fa[x]] == x)
      ls[fa[x]] = v;
    else if (rs[fa[x]] == x)
      rs[fa[x]] = v;
    fa[v] = fa[x], fa[x] = v, fa[u] = v;
    ls[v] = u, rs[v] = x, lc[u] = rc[u] = u;
    lc[v] = u, rc[v] = rc[x];
    return;
  }
  getroot(x, 0, sz[x], root, root_size);
  if ((!ls[root] || vis[ls[root]]) && (!rs[root] || vis[rs[root]]))
    root = fa[root];
  int res = query(lc[root], rc[root], cnt);
  if (res == 1) vis[ls[root]] = vis[rs[root]] = true, solve(root);
  if (res == 2) vis[root] = true, solve(rs[root]);
  if (res == 3) vis[root] = true, solve(ls[root]);
}
int main() {
  cin >> n, lc[1] = rc[1] = 1;
  for (int i = 2; i <= n; i++) {
    memset(vis, 0, sizeof(vis)), cnt++, solve(1);
  }
  cout << "-1" << endl;
  for (int i = 1; i <= 2 * n - 1; i++) {
    cout << (fa[i] ? fa[i] : -1) << " ";
  }
  return 0;
}
