#include <bits/stdc++.h>
using namespace std;
vector<int> son[605];
queue<int> q;
int g1, tmp[605], n, i, fa[605], tot, uu[605], cnt, c[605], dep[605];
bool ask(int k, int l, int r) {
  int f1, f2;
  cout << "? " << r - l + 2 << " " << k << " ";
  for (int i = l; i <= r; ++i) cout << tmp[i] << " ";
  cout << "\n";
  cout.flush();
  cin >> f1;
  cout << "? " << r - l + 1 << " ";
  for (int i = l; i <= r; ++i) cout << tmp[i] << " ";
  cout << "\n";
  cout.flush();
  cin >> f2;
  return f1 != f2;
}
void find(int k, int l, int r) {
  if (l == r) {
    uu[++tot] = tmp[l];
    return;
  }
  if (ask(k, l, (l + r >> 1))) find(k, l, (l + r >> 1));
  if (ask(k, (l + r >> 1) + 1, r)) find(k, (l + r >> 1) + 1, r);
}
void gg() {
  int x, i;
  cout << "? " << cnt << " ";
  for (int i = 1; i <= cnt; ++i) cout << tmp[i] << " ";
  cout << "\n";
  cout.flush();
  cin >> x;
  if (!x) return;
  tot = 0;
  for (i = 2; i <= cnt; ++i)
    if (ask(tmp[i], 1, i - 1)) {
      g1 = tmp[i];
      find(tmp[i], 1, i - 1);
      return;
    }
  for (i = 1; i < cnt; ++i)
    if (ask(tmp[i], i + 1, cnt)) {
      g1 = tmp[i];
      find(tmp[i], i + 1, cnt);
      return;
    }
}
void dfs(int now, int fat) {
  fa[now] = fat;
  dep[now] = dep[fat] + 1;
  for (int i = 0, T; i < son[now].size(); ++i)
    if ((T = son[now][i]) != fat) dfs(T, now);
}
int x, r, e[605][2], j, ed, y;
int main() {
  cin >> n;
  if (n == 1) {
    cout << "Y 0\n";
  }
  for (i = 1; i < n; ++i) {
    tmp[i] = i;
  }
  cnt = n - 1;
  q.push(n);
  c[n] = 1;
  dep[n] = 0;
  while (cnt && q.size()) {
    x = q.front();
    q.pop();
    tot = 0;
    if (cnt != 1 || ask(x, 1, cnt)) find(x, 1, cnt);
    for (i = 1; i <= tot; ++i) {
      r = uu[i];
      c[r] = c[x] ^ 1;
      e[++ed][c[r]] = r;
      e[ed][c[x]] = x;
      dep[r] = dep[x] + 1;
      q.push(r);
      for (j = 1; j < cnt; ++j)
        if (tmp[j] == r) swap(tmp[j], tmp[j + 1]);
      --cnt;
    }
  }
  cnt = 0;
  for (i = 1; i <= n; ++i)
    if (c[i]) ++cnt;
  cout << "? " << cnt << " ";
  for (i = 1; i <= n; ++i)
    if (c[i]) cout << i << " ";
  cout << '\n';
  cout.flush();
  cin >> x;
  cnt = 0;
  for (i = 1; i <= n; ++i)
    if (!c[i]) ++cnt;
  cout << "? " << cnt << " ";
  for (i = 1; i <= n; ++i)
    if (!c[i]) cout << i << " ";
  cout << '\n';
  cout.flush();
  cin >> y;
  if (!x && !y) {
    cout << "Y " << cnt << '\n';
    for (i = 1; i <= n; ++i)
      if (!c[i]) cout << i << " ";
    return 0;
  }
  for (i = 1; i < n; ++i) {
    son[e[i][0]].push_back(e[i][1]);
    son[e[i][1]].push_back(e[i][0]);
  }
  for (i = 1; i <= n; ++i) {
    cnt = 0;
    for (j = 1; j <= n; ++j)
      if (dep[j] == i) tmp[++cnt] = j;
    gg();
    if (g1) {
      dep[g1] = 1;
      dfs(g1, 0);
      cout << "N " << dep[uu[1]] << "\n";
      while (uu[1]) {
        cout << uu[1] << " ";
        uu[1] = fa[uu[1]];
      }
      return 0;
    }
  }
}
