#include <bits/stdc++.h>
using namespace std;
long long modpow(long long a, long long b,
                 long long mod = (long long)(1e9 + 7)) {
  if (!b) return 1;
  a %= mod;
  return modpow(a * a % mod, b / 2, mod) * (b & 1 ? a : 1) % mod;
}
const int maxn = 1000;
int n;
map<string, int> ash;
vector<int> adj[maxn];
bool inside[maxn];
int x = 0;
string convert(vector<int> a) {
  sort(a.begin(), a.end());
  string s;
  for (int x : a) {
    s += to_string(x);
    s += " ";
  }
  return s;
}
int interact(vector<int> a) {
  if (a.size() <= 1) return 0;
  string symbol = convert(a);
  if (ash.count(symbol)) return ash[symbol];
  cout << "? " << a.size() << endl;
  for (int x : a) cout << x + 1 << " ";
  cout << endl;
  fflush(stdin);
  int x;
  cin >> x;
  return ash[symbol] = x;
}
int interact(vector<int> a, vector<int> b) {
  set<int> arr;
  for (int x : a) arr.insert(x);
  for (int y : b) arr.insert(y);
  vector<int> book;
  for (int x : arr) book.push_back(x);
  return interact(book);
}
int e(vector<int> a, vector<int> b) {
  return interact(a, b) - interact(a) - interact(b);
}
int search(vector<int> a, vector<int> b) {
  if (!a.size() || !b.size()) return -1;
  if (a.size() == 1 && b.size() == 1) {
    adj[a[0]].push_back(b[0]), adj[b[0]].push_back(a[0]);
    inside[a[0]] = inside[b[0]] = true;
    return a[0];
  }
  if (a.size() == 1) return search(b, a);
  vector<int> c, d;
  for (int i = 0; i < a.size(); i++)
    if (i % 2)
      c.push_back(a[i]);
    else
      d.push_back(a[i]);
  if (e(c, b)) return search(c, b);
  return search(d, b);
}
void dfs(int v, int p, vector<int> &a, vector<int> &b, bool first) {
  if (first)
    a.push_back(v);
  else
    b.push_back(v);
  for (int w : adj[v])
    if (w != p) dfs(w, v, a, b, !first);
}
void edfs(int v, int p, int st, vector<int> &stack) {
  stack.push_back(v);
  for (int w : adj[v])
    if (w != p)
      if (w == st) {
        cout << "N " << stack.size() << endl;
        for (int x : stack) cout << x + 1 << " ";
        cout << endl;
        exit(0);
      } else
        edfs(w, v, st, stack);
  stack.pop_back();
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  memset(inside, false, sizeof(inside));
  inside[0] = true;
  for (int _ = 0; _ < n - 1; _++) {
    vector<int> a, b;
    for (int i = 0; i < n; i++)
      if (inside[i])
        a.push_back(i);
      else
        b.push_back(i);
    search(a, b);
    x++;
  }
  vector<int> a;
  vector<int> b;
  dfs(0, -1, a, b, true);
  int x = interact(a), y = interact(b);
  if (!x && !y) {
    cout << "Y " << a.size() << endl;
    for (int x : a) cout << x + 1 << " ";
    cout << endl;
  } else {
    int s = 0;
    if (x) {
      vector<int> ls;
      while (a.size()) {
        ls.push_back(a.back()), a.pop_back();
        if (e(a, ls)) {
          search(a, ls);
          break;
        }
      }
    } else if (y) {
      vector<int> ls;
      while (b.size()) {
        ls.push_back(b.back()), b.pop_back();
        if (e(b, ls)) {
          search(b, ls);
          break;
        }
      }
    }
    vector<int> stack;
    edfs(s, -1, s, stack);
  }
  return 0;
}
