#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline bool upmin(T &x, T y) {
  return y < x ? x = y, 1 : 0;
}
template <typename T>
inline bool upmax(T &x, T y) {
  return x < y ? x = y, 1 : 0;
}
const long double eps = 1e-9;
const long double pi = acos(-1);
const int oo = 1 << 30;
const long long loo = 1ll << 60;
const int mods = 998244353;
const int MAXN = 600005;
const int INF = 0x3f3f3f3f;
int n, CNT = 0;
namespace Checker {
int flag[605][605], id[605];
void Init() {
  srand(time(0));
  n = 600;
  int m = 20000;
  for (int i = 1, x; i < n; ++i)
    x = rand() % i + 1, flag[i + 1][x] = flag[x][i + 1] = 1,
    cout << "TREE: " << x << " " << i + 1 << endl;
  for (int i = 1; i <= m; ++i) {
    int x = rand() % n + 1, y = rand() % n + 1;
    if (x == y || flag[x][y]) continue;
    cout << "TREE: " << x << " " << y << endl;
    flag[x][y] = flag[y][x] = 1;
  }
}
int Query(vector<int> &V) {
  ++CNT;
  int ans = 0;
  for (int i = 0; i < (int)V.size(); ++i)
    for (int j = i + 1; j < (int)V.size(); ++j) ans += flag[V[i]][V[j]];
  cout << "Query: " << ans << endl;
  return ans;
}
void checkNO(vector<int> &V) {
  if (V.size() % 2 == 0) {
    cerr << "Wrong Answer!" << endl;
    return;
  }
  int Flag = flag[V.back()][V[0]];
  for (int i = 0; i < (int)V.size() - 1; ++i)
    if (!flag[V[i]][V[i + 1]]) Flag = 0;
  if (Flag)
    cerr << "Accepted!" << endl;
  else
    cerr << "Wrong Answer!" << endl;
  cerr << CNT << endl;
}
void checkYES(vector<int> &V, vector<int> &_V) {
  int Flag = 1;
  for (int i = 0; i < (int)V.size(); ++i)
    for (int j = i + 1; j < (int)V.size(); ++j)
      if (flag[V[i]][V[j]]) Flag = 0;
  for (int i = 0; i < (int)_V.size(); ++i)
    for (int j = i + 1; j < (int)_V.size(); ++j)
      if (flag[_V[i]][_V[j]]) Flag = 0;
  if (Flag)
    cerr << "Accepted!" << endl;
  else
    cerr << "Wrong Answer!" << endl;
  cerr << CNT << endl;
}
}  // namespace Checker
int Nw, nw, fa[1005], dep[1005];
vector<int> V, _V, B, L, R, e[1005];
int Query(vector<int> &V) {
  if (V.size() <= 1) return 0;
  printf("? %d\n", (int)V.size());
  for (auto v : V) printf("%d ", v);
  puts(""), fflush(stdout);
  int x;
  scanf("%d", &x);
  fflush(stdout);
  return x;
}
int find(int l, int r) {
  if (l == r) return _V[l];
  int mid = (l + r) >> 1;
  B.clear();
  for (int i = l; i <= mid; ++i) B.push_back(_V[i]);
  int q = Query(B);
  for (auto v : V) B.push_back(v);
  int p = Query(B);
  if (p - q == nw) return find(mid + 1, r);
  return find(l, mid);
}
int Find(int l, int r, int id) {
  if (l == r) return V[l];
  int mid = (l + r) >> 1;
  B.clear();
  for (int i = l; i <= mid; ++i) B.push_back(V[i]);
  int q = Query(B);
  B.push_back(id);
  int p = Query(B);
  if (p == q) return Find(mid + 1, r, id);
  return Find(l, mid, id);
}
void dfs(int x, int father, int Dep) {
  if (Dep & 1)
    R.push_back(x);
  else
    L.push_back(x);
  fa[x] = father, dep[x] = Dep;
  for (auto v : e[x]) {
    if (v == father) continue;
    dfs(v, x, Dep + 1);
  }
}
void putNO(int u, int v) {
  vector<int> Ans, stk;
  Ans.clear(), stk.clear();
  while (u != v) {
    if (dep[u] > dep[v])
      Ans.push_back(u), u = fa[u];
    else
      stk.push_back(v), v = fa[v];
  }
  Ans.push_back(u);
  reverse(stk.begin(), stk.end());
  for (auto v : stk) Ans.push_back(v);
  printf("N %d\n", (int)Ans.size());
  for (auto v : Ans) printf("%d ", v);
  puts("");
}
signed main() {
  scanf("%d", &n);
  srand(time(0));
  V.push_back(1);
  for (int i = 1; i <= n; ++i)
    if (i != 1) _V.push_back(i);
  random_shuffle(_V.begin(), _V.end());
  for (int i = 1; i < n; ++i) {
    nw = Query(V);
    int q = find(0, _V.size() - 1);
    int p = Find(0, V.size() - 1, q);
    e[p].push_back(q), e[q].push_back(p);
    V.push_back(q), _V.erase(find(_V.begin(), _V.end(), q));
  }
  dfs(1, 0, 0);
  B.clear();
  for (auto v : L) B.push_back(v);
  if (Query(B))
    for (auto v : L) {
      B.clear();
      for (auto u : L)
        if (u != v) B.push_back(u);
      int p = Query(B);
      B.push_back(v);
      int q = Query(B);
      if (p == q) continue;
      for (auto u : L) {
        if (u == v) continue;
        B.clear();
        B.push_back(u), B.push_back(v);
        if (Query(B)) {
          putNO(u, v);
          return 0;
        }
      }
    }
  B.clear();
  for (auto v : R) B.push_back(v);
  if (Query(B))
    for (auto v : R) {
      B.clear();
      for (auto u : R)
        if (u != v) B.push_back(u);
      int p = Query(B);
      B.push_back(v);
      int q = Query(B);
      if (p == q) continue;
      for (auto u : R) {
        if (u == v) continue;
        B.clear();
        B.push_back(u), B.push_back(v);
        if (Query(B)) {
          putNO(u, v);
          return 0;
        }
      }
    }
  printf("Y %d\n", (int)L.size());
  for (auto v : L) printf("%d ", v);
  puts("");
  return 0;
}
