#include <bits/stdc++.h>
inline int query(int x, int y, int z) {
  printf("%d %d %d\n", x, y, z);
  fflush(stdout);
  std::string c;
  std::cin >> c;
  if (c == "X") return 1;
  if (c == "Y") return 2;
  if (c == "Z") return 3;
}
int n, last;
int papa[1 + 2 * 1000];
int left[1 + 2 * 1000], right[1 + 2 * 1000];
int l[1 + 2 * 1000], r[1 + 2 * 1000];
int seen[1 + 2 * 1000];
std::vector<int> G[1 + 2 * 1000];
int total, mainRoot, w[1 + 2 * 1000];
void weight(int node, int fth, int index) {
  total++;
  w[node] = 1;
  for (auto y : G[node])
    if (y != fth && seen[y] != index) {
      weight(y, node, index);
      w[node] += w[y];
    }
}
void getRoot(int node, int fth, int index) {
  if (mainRoot) return;
  int ok = 1;
  if (fth != 0 && total - w[node] > total / 2) ok = 0;
  for (auto y : G[node])
    if (y != fth && seen[y] != index) {
      if (w[y] > total / 2) ok = 0;
      getRoot(y, node, index);
    }
  if (ok) mainRoot = node;
}
inline int centroid(int root, int index) {
  total = 0;
  weight(root, 0, index);
  mainRoot = 0;
  getRoot(root, 0, index);
  return mainRoot;
}
inline void erase(int node, int element) {
  for (int i = 0; i < G[node].size(); i++)
    if (G[node][i] == element) {
      std::swap(G[node][i], G[node].back());
      G[node].pop_back();
    }
}
inline void insert(int node, int prevPapa, int i) {
  last++;
  if (left[prevPapa] == node) {
    left[prevPapa] = last, papa[last] = prevPapa;
    left[last] = node, papa[node] = last;
    right[last] = i, papa[i] = last;
    l[last] = l[node], r[last] = i;
  } else {
    right[prevPapa] = last, papa[last] = prevPapa;
    right[last] = node, papa[node] = last;
    left[last] = i, papa[i] = last;
    r[last] = r[node], l[last] = i;
  }
  l[i] = r[i] = i;
  erase(node, prevPapa);
  erase(prevPapa, node);
  G[prevPapa].push_back(last), G[last].push_back(prevPapa);
  G[node].push_back(last), G[last].push_back(node);
  G[i].push_back(last), G[last].push_back(i);
}
int main() {
  std::cin >> n;
  last = n + 1;
  papa[1] = papa[2] = n + 1;
  left[n + 1] = l[n + 1] = 1, right[n + 1] = r[n + 1] = 2;
  l[1] = r[1] = 1;
  l[2] = r[2] = 2;
  G[1].push_back(n + 1), G[n + 1].push_back(1);
  G[2].push_back(n + 1), G[n + 1].push_back(2);
  for (int i = 3; i <= n; i++) {
    int tmpRoot = 1;
    while (true) {
      int node = centroid(tmpRoot, i);
      if (node <= n) node = papa[node];
      int ans = query(l[node], r[node], i);
      seen[node] = i;
      if (ans == 1) {
        if (papa[node] == 0 || seen[papa[node]] == i) {
          insert(node, papa[node], i);
          break;
        } else
          tmpRoot = papa[node];
      } else if (ans == 2) {
        if (right[node] <= n || seen[right[node]] == i) {
          insert(right[node], node, i);
          break;
        } else
          tmpRoot = right[node];
      } else {
        if (left[node] <= n || seen[left[node]] == i) {
          insert(left[node], node, i);
          break;
        } else
          tmpRoot = left[node];
      }
    }
  }
  printf("-1\n");
  for (int i = 1; i <= 2 * n - 1; i++) {
    if (papa[i] == 0)
      printf("%d ", -1);
    else
      printf("%d ", papa[i]);
  }
  fflush(stdout);
  return 0;
}
