#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 10;
const int maxn5 = 5e5 + 10;
const int maxnt = 1.2e6 + 10;
const int maxn3 = 1e3 + 10;
const long long mod = 1e9 + 7;
const long long inf = 2e18;
vector<int> av, s, tem, tbrem, cy, adj[maxn5], part[2];
bool mark[maxn5];
int ty[maxn5], par[maxn5];
queue<int> q;
int ask() {
  if (s.size() < 2) return 0;
  cout << "? " << s.size() << '\n';
  for (auto u : s) cout << u << ' ';
  cout << endl;
  int x;
  cin >> x;
  if (x == -1) exit(0);
  return x;
}
void rem(int v) {
  tem.clear();
  while (av.back() != v) {
    tem.push_back(av.back());
    av.pop_back();
  }
  av.pop_back();
  for (auto u : tem) av.push_back(u);
  return;
}
void dfs(int v) {
  mark[v] = true;
  for (auto u : adj[v])
    if (!mark[u]) {
      par[u] = v;
      dfs(u);
    }
  return;
}
void make_edge(int v, int l, int r, int last) {
  if (r - l == 1) {
    tbrem.push_back(av[l]);
    q.push(av[l]);
    adj[v].push_back(av[l]);
    adj[av[l]].push_back(v);
    ty[av[l]] = (ty[v] ^ 1);
    part[ty[av[l]]].push_back(av[l]);
    return;
  }
  int mid = (l + r) >> 1;
  s.clear();
  for (int i = l; i < mid; i++) s.push_back(av[i]);
  int x = ask();
  s.push_back(v);
  int y = ask();
  if (y - x > 0) make_edge(v, l, mid, y - x);
  if (last - (y - x) > 0) make_edge(v, mid, r, last - (y - x));
  return;
}
pair<int, int> find_edge() {
  int u = -1;
  while (!s.empty()) {
    int v = s.back();
    int x = ask();
    s.pop_back();
    int y = ask();
    if (x - y > 0) {
      u = v;
      break;
    }
  }
  for (auto v : s) {
    cout << "? 2\n" << v << ' ' << u << endl;
    int x;
    cin >> x;
    if (x == -1) exit(0);
    if (x == 1) return {u, v};
  }
  return {-1, -1};
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  q.push(1);
  for (int i = 2; i <= n; i++) av.push_back(i);
  part[0].push_back(1);
  while (!q.empty()) {
    int v = q.front();
    q.pop();
    tbrem.clear();
    s.clear();
    for (auto u : av) s.push_back(u);
    int val = ask();
    s.push_back(v);
    int val2 = ask();
    if (val2 - val > 0) make_edge(v, 0, av.size(), val2 - val);
    for (auto u : tbrem) rem(u);
  }
  s.clear();
  for (auto u : part[0]) s.push_back(u);
  int x = ask();
  pair<int, int> p = {-1, -1};
  if (x > 0) p = find_edge();
  s.clear();
  for (auto u : part[1]) s.push_back(u);
  x = ask();
  if (x > 0) p = find_edge();
  if (p.first == -1) {
    cout << "Y " << part[1].size() << endl;
    for (auto u : part[1]) cout << u << ' ';
    return cout << endl, 0;
  }
  dfs(p.first);
  int v = p.second;
  cy.push_back(v);
  while (v != p.first) {
    v = par[v];
    cy.push_back(v);
  }
  cout << "N " << cy.size() << endl;
  for (auto u : cy) cout << u << ' ';
  cout << endl;
  return 0;
}
