#include <bits/stdc++.h>
using namespace std;
const int N = 605;
int n;
vector<int> g[N];
map<vector<int>, int> memo;
int ask(vector<int> &vs) {
  if (int((vs).size()) <= 1) return 0;
  sort((vs).begin(), (vs).end());
  if (memo.count(vs)) return memo[vs];
  cout << "? " << int((vs).size()) << endl;
  for (int x = (0), qwerty = (int((vs).size())); x < qwerty; x++) {
    if (x) cout << " ";
    cout << vs[x];
  }
  cout << endl;
  int v;
  cin >> v;
  return memo[vs] = v;
}
pair<int, int> f(vector<int> vs1, vector<int> vs2, bool b) {
  if (int((vs1).size()) == 1 && int((vs2).size()) == 1) {
    if (!b) {
      vector<int> vs = {vs1[0], vs2[0]};
      int v = ask(vs);
      if (!v) return {-1, -1};
    }
    return {vs1[0], vs2[0]};
  }
  vector<int> vs = vs1;
  for (int v : vs2) vs.push_back(v);
  int A, B, AB, abo;
  if (!b)
    A = ask(vs1), B = ask(vs2), AB = ask(vs), abo = AB - A - B;
  else
    abo = 1;
  if (!abo) return {-1, -1};
  bool rev = 0;
  if (int((vs2).size()) == 1) swap(vs1, vs2), rev = 1;
  vector<int> vs2_0, vs2_1;
  for (int x = (0), qwerty = (int((vs2).size()) / 2); x < qwerty; x++)
    vs2_0.push_back(vs2[x]);
  for (int x = (int((vs2).size()) / 2), qwerty = (int((vs2).size()));
       x < qwerty; x++)
    vs2_1.push_back(vs2[x]);
  pair<int, int> tmp = f(vs1, vs2_0, 0);
  if (tmp.first == -1) tmp = f(vs1, vs2_1, 1);
  if (rev) swap(tmp.first, tmp.second);
  return tmp;
}
vector<int> cs[2];
int dep[N], par[N];
void dfs(int u, int p, int c) {
  cs[c].push_back(u);
  for (int v : g[u])
    if (v != p) par[v] = u, dep[v] = dep[u] + 1, dfs(v, u, !c);
}
pair<int, int> solve(vector<int> vs) {
  vector<int> vs1, vs2;
  for (int x = (0), qwerty = (int((vs).size()) / 2); x < qwerty; x++)
    vs1.push_back(vs[x]);
  for (int x = (int((vs).size()) / 2), qwerty = (int((vs).size())); x < qwerty;
       x++)
    vs2.push_back(vs[x]);
  int A = ask(vs1), B = ask(vs2), AB = ask(vs), ABo = AB - A - B;
  if (A) return solve(vs1);
  if (B) return solve(vs2);
  assert(ABo > 0);
  return f(vs1, vs2, 0);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  vector<int> nused, used;
  for (int x = (1), qwerty = (n + 1); x < qwerty; x++) nused.push_back(x);
  random_shuffle((nused).begin(), (nused).end());
  used.push_back(nused.back());
  nused.pop_back();
  for (int x = (1), qwerty = (n); x < qwerty; x++) {
    pair<int, int> tmp = f(used, nused, 0);
    int idx = -1;
    for (int i = (0), qwerty = (int((nused).size())); i < qwerty; i++)
      if (nused[i] == tmp.second) idx = i;
    assert(idx != -1);
    swap(nused.back(), nused[idx]);
    nused.pop_back();
    used.push_back(tmp.second);
    sort((used).begin(), (used).end());
    g[tmp.first].push_back(tmp.second);
    g[tmp.second].push_back(tmp.first);
  }
  dfs(1, 0, 0);
  if (ask(cs[0]) == 0 && ask(cs[1]) == 0) {
    cout << "Y " << int((cs[0]).size()) << endl;
    for (int x = (0), qwerty = (int((cs[0]).size())); x < qwerty; x++) {
      if (x) cout << " ";
      cout << cs[0][x];
    }
    cout << endl;
  } else {
    if (ask(cs[0]) == 0) swap(cs[0], cs[1]);
    pair<int, int> tmp = solve(cs[0]);
    assert(tmp.first != -1);
    vector<int> vs1, vs2;
    int u = tmp.first, v = tmp.second;
    while (u != v) {
      if (dep[u] < dep[v]) {
        vs2.push_back(v);
        v = par[v];
      } else {
        vs1.push_back(u);
        u = par[u];
      }
    }
    vs1.push_back(u);
    reverse((vs1).begin(), (vs1).end());
    for (int v : vs2) vs1.push_back(v);
    cout << "N " << int((vs1).size()) << endl;
    for (int x = (0), qwerty = (int((vs1).size())); x < qwerty; x++) {
      if (x) cout << " ";
      cout << vs1[x];
    }
    cout << endl;
  }
}
