#include <bits/stdc++.h>
using namespace std;
const int N = 600 + 5;
int n;
int qno = 0;
int query(bitset<N> &bs) {
  if (bs.count() <= 1) return 0;
  cout << "? " << bs.count() << endl;
  for (int i = 1; i <= n; i++) {
    if (bs[i]) cout << i << " ";
  }
  cout << endl;
  qno++;
  assert(qno <= 20000);
  int ans;
  cin >> ans;
  return ans;
}
bitset<N> ss[3];
vector<int> adj[N];
int vis[N];
void dfs(int v, int c) {
  vis[v] = c;
  ss[c][v] = 1;
  int la = 0;
  while (1) {
    la++;
    int bb = la;
    bitset<N> bs;
    for (int i = bb; i <= n; i++) {
      if (vis[i] == 0) bs[i] = 1;
    }
    bs[v] = 0;
    int without = query(bs);
    bs[v] = 1;
    int with = query(bs);
    if (with == without) {
      break;
    }
    int ra = n;
    while (la < ra) {
      int m = (la + ra) >> 1;
      bitset<N> bs;
      for (int i = bb; i <= m; i++) {
        if (vis[i] == 0) bs[i] = 1;
      }
      bs[v] = 0;
      int without = query(bs);
      bs[v] = 1;
      int with = query(bs);
      if (with > without) {
        ra = m;
      } else
        la = m + 1;
    }
    adj[v].push_back(la);
    adj[la].push_back(v);
    dfs(la, 3 - c);
  }
}
int visited[N];
vector<int> path;
bool find_path(int v, int t) {
  visited[v] = 1;
  path.push_back(v);
  if (v == t) return true;
  for (auto it : adj[v]) {
    if (!visited[it] and find_path(it, t)) return true;
  }
  path.pop_back();
  return false;
}
void find_cycle(bitset<N> bs) {
  int init = query(bs);
  int ca = -1, cb = -1;
  for (int i = 1; i <= n; i++) {
    if (bs[i] == 1) {
      bs[i] = 0;
      if (query(bs) < init) {
        ca = i;
      }
      bs[i] = 1;
      if (ca != -1) break;
    }
  }
  bitset<N> temp;
  temp[ca] = 1;
  for (int i = 1; i <= n; i++) {
    if (bs[i] == 1 and i != ca) {
      temp[i] = 1;
      if (query(temp)) {
        cb = i;
      }
      temp[i] = 0;
      if (cb != -1) break;
    }
  }
  assert(find_path(ca, cb));
  assert(path.size() >= 3 and (path.size() & 1));
  cout << "N " << path.size() << endl;
  for (auto it : path) {
    cout << it << " ";
  }
  cout << endl;
  exit(0);
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    if (vis[i]) continue;
    dfs(i, 1);
  }
  if (query(ss[1])) {
    find_cycle(ss[1]);
  }
  if (query(ss[2])) {
    find_cycle(ss[2]);
  }
  cout << "Y " << ss[1].count() << endl;
  for (int i = 1; i <= n; i++) {
    if (ss[1][i]) cout << i << " ";
  }
  cout << endl;
  return 0;
}
