#include <bits/stdc++.h>
using namespace std;
const int N = 605;
int n, pter, par[N];
vector<int> gr[N], curVer, part1, part2;
bool used[N];
int query1(vector<int> vec) {
  cout << "? " << vec.size() << '\n';
  for (int i : vec) cout << i << ' ';
  cout << '\n';
  cout.flush();
  int inp;
  cin >> inp;
  return inp;
}
int query2(int vertex, vector<int> vec) {
  vector<int> _vec;
  _vec = vec;
  _vec.push_back(vertex);
  return query1(_vec) - query1(vec);
}
void dfs(int u, int p, bool sta) {
  if (sta)
    part1.push_back(u);
  else
    part2.push_back(u);
  for (int v : gr[u])
    if (v != p) dfs(v, u, sta ^ 1);
}
void bfs(int src) {
  memset(used, 0, sizeof used);
  queue<int> q;
  q.push(src);
  used[src] = 1;
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (int v : gr[u])
      if (!used[v]) used[v] = 1, par[v] = u, q.push(v);
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  curVer.push_back(1);
  used[1] = 1;
  if (n == 1) {
    cout << "Y " << 1 << '\n';
    cout << 1 << '\n';
    cout.flush();
    return 0;
  }
  while (curVer.size() < n) {
    while (1) {
      vector<int> vec;
      for (int i = 1; i <= n; ++i)
        if (!used[i]) vec.push_back(i);
      if (query2(curVer[pter], vec)) break;
      pter++;
    }
    vector<int> vec;
    for (int i = 1; i <= n; ++i)
      if (!used[i]) vec.push_back(i);
    while (vec.size() > 1) {
      vector<int> vec1, vec2;
      for (int i = 0; i < vec.size() / 2; ++i) vec1.push_back(vec[i]);
      for (int i = vec.size() / 2; i < vec.size(); ++i) vec2.push_back(vec[i]);
      if (query2(curVer[pter], vec1))
        vec = vec1;
      else
        vec = vec2;
    }
    gr[vec.back()].push_back(curVer[pter]);
    gr[curVer[pter]].push_back(vec.back());
    curVer.push_back(vec.back());
    used[vec.back()] = 1;
  }
  dfs(1, 1, 0);
  if (!query1(part1) && !query1(part2)) {
    cout << "Y " << part1.size() << '\n';
    for (int i : part1) cout << i << ' ';
    cout << '\n';
    cout.flush();
  } else {
    if (!query1(part1)) swap(part1, part2);
    while (1) {
      vector<int> vec = part1;
      vec.pop_back();
      if (!query1(vec)) break;
      part1.pop_back();
    }
    reverse(part1.begin(), part1.end());
    while (part1.size() > 2) {
      vector<int> tmp;
      tmp.push_back(part1[0]);
      tmp.push_back(part1.back());
      if (query1(tmp)) break;
      part1.pop_back();
    }
    bfs(part1[0]);
    vector<int> ans;
    int cur = part1.back();
    while (cur) {
      ans.push_back(cur);
      cur = par[cur];
    }
    cout << "N " << ans.size() << '\n';
    for (int i : ans) cout << i << ' ';
    cout << '\n';
    cout.flush();
  }
  return 0;
}
