#include <bits/stdc++.h>
using namespace std;
const int N = 2005;
int ch[N][2], fa[N], sz[N];
bool vis[N];
int cc;
void dfs1(int pos) {
  if (vis[pos] || !pos) return;
  ++cc;
  if (ch[pos][0] || ch[pos][1]) dfs1(ch[pos][0]), dfs1(ch[pos][1]);
}
int mnv = INT_MAX, rt;
void dfs2(int pos) {
  if (vis[pos] || !pos) return;
  int mx = 0;
  sz[pos] = 1;
  if (ch[pos][0] || ch[pos][1]) {
    for (int i = 0; i < 2; i++) {
      if (vis[ch[pos][i]]) continue;
      dfs2(ch[pos][i]);
      sz[pos] += sz[ch[pos][i]];
      mx = max(mx, sz[ch[pos][i]]);
    }
    if (max(cc - mx, mx) < mnv) mnv = max(cc - mx, mx), rt = pos;
  }
}
int idx;
void solve(int pos, int tt) {
  if (vis[pos] || (!ch[pos][0] && !ch[pos][1])) {
    int tmp = idx++;
    ch[fa[pos]][pos == ch[fa[pos]][1]] = tmp;
    fa[tmp] = fa[pos];
    fa[tt] = fa[pos] = tmp;
    ch[tmp][0] = tt;
    ch[tmp][1] = pos;
    return;
  }
  cc = 0;
  dfs1(pos);
  mnv = INT_MAX;
  dfs2(pos);
  int le = rt, ri = rt;
  while (ch[le][0]) le = ch[le][0];
  while (ch[ri][1]) ri = ch[ri][1];
  cout << le << ' ' << ri << ' ' << tt << endl;
  char c;
  cin >> c;
  vis[rt] = 1;
  if (c == 'Z') return solve(ch[rt][0], tt);
  if (c == 'Y') return solve(ch[rt][1], tt);
  if (vis[fa[rt]] || !fa[rt]) {
    int tmp = idx++;
    fa[tmp] = fa[rt];
    ch[fa[rt]][rt == ch[fa[rt]][1]] = tmp;
    fa[tt] = fa[rt] = tmp;
    ch[tmp][0] = rt;
    ch[tmp][1] = tt;
    return;
  }
  int cur = fa[rt];
  while (!vis[fa[cur]] && fa[cur]) cur = fa[cur];
  solve(cur, tt);
}
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  idx = n + 2;
  ch[n + 1][0] = 1;
  ch[n + 1][1] = 2;
  fa[1] = fa[2] = n + 1;
  for (int i = 3; i <= n; i++) {
    memset(vis, 0, sizeof(vis));
    int cur = 1;
    while (fa[cur]) cur = fa[cur];
    solve(cur, i);
  }
  cout << -1 << endl;
  for (int i = 1; i <= n * 2 - 1; i++) cout << (fa[i] ? fa[i] : -1) << ' ';
  cout << endl;
  return 0;
}
