#include <bits/stdc++.h>
template <typename T>
bool ckmax(T &x, T y) {
  return x < y ? x = y, true : false;
}
template <typename T>
bool ckmin(T &x, T y) {
  return x > y ? x = y, true : false;
}
using namespace std;
const long long inf = 1000000000;
const double Pi = acos(-1);
const long long mod = 998244353;
const double eps = 1e-6;
inline long long fpow(long long a, long long b = mod - 2, long long p = mod) {
  a %= p;
  long long res = 1;
  while (b) {
    if (b & 1) res = 1ll * res * a % p;
    a = 1ll * a * a % p;
    b >>= 1;
  }
  return res;
}
inline long long read() {
  char c = getchar();
  long long x = 0;
  bool f = 0;
  for (; !isdigit(c); c = getchar()) f ^= !(c ^ 45);
  for (; isdigit(c); c = getchar()) x = (x << 1) + (x << 3) + (c ^ 48);
  if (f) x = -x;
  return x;
}
inline void write(long long x) {
  if (x < 0) {
    putchar('-');
    write(-x);
    return;
  }
  if (x >= 10) write(x / 10);
  putchar(x % 10 + '0');
}
inline void writesp(long long x) { write(x), putchar(' '); }
inline void writeln(long long x) {
  write(x);
  putchar('\n');
}
long long query1(vector<long long> &t) {
  if (!t.size() || (long long)t.size() == 1) return 0;
  cout << "? " << t.size() << endl;
  for (long long i : t) cout << i << " ";
  cout << endl;
  static long long x;
  cin >> x;
  if (x == -1) exit(0);
  return x;
}
long long query2(long long x, vector<long long> &t) {
  static long long v1, v2;
  v1 = query1(t);
  t.push_back(x);
  v2 = query1(t);
  t.pop_back();
  return v2 - v1;
}
long long n;
long long vis[666], fa[666], dep[666];
vector<long long> t, s;
deque<long long> q;
void divide(long long u, long long cnt, vector<long long> &t) {
  if (!t.size() || !cnt) return;
  if ((long long)t.size() == 1) {
    long long v = t.front();
    q.push_back(v);
    fa[v] = u;
    vis[v] = 1;
    dep[v] = dep[u] + 1;
    return;
  }
  long long mid = t.size() >> 1;
  vector<long long> t1, t2;
  for (long long i = (0), iE = (mid - 1); i <= iE; i++) t1.push_back(t[i]);
  for (long long i = (mid), iE = ((long long)t.size() - 1); i <= iE; i++)
    t2.push_back(t[i]);
  long long tt = query2(u, t1);
  divide(u, tt, t1), divide(u, cnt - tt, t2);
}
void bfs(long long s) {
  q.push_back(s);
  vis[s] = 1;
  long long u;
  while ((long long)q.size() > 0) {
    u = q.front();
    q.pop_front();
    t.clear();
    for (long long i = (1), iE = (n); i <= iE; i++)
      if (!vis[i]) t.push_back(i);
    if ((long long)t.size() > 0) divide(u, query2(u, t), t);
  }
}
void printno(vector<long long> &t) {
  long long u, v;
  while ((long long)t.size()) {
    u = t.back();
    t.pop_back();
    if (!query2(u, t)) continue;
    long long l = 0, r = (long long)t.size() - 1;
    while (l < r) {
      long long mid = (l + r) >> 1;
      vector<long long> tmp;
      for (long long i = (l), iE = (mid); i <= iE; i++) tmp.push_back(t[i]);
      if (query2(u, tmp))
        r = mid;
      else
        l = mid + 1;
    }
    v = t[l];
    break;
  }
  q.clear();
  q.push_back(u), q.push_back(v);
  while (u ^ v) {
    if (dep[u] < dep[v])
      v = fa[v], q.push_back(v);
    else
      u = fa[u], q.push_front(u);
  }
  q.pop_front();
  cout << "N " << q.size() << endl;
  while ((long long)q.size() > 0) {
    u = q.front();
    q.pop_front();
    cout << u << " ";
  }
  cout << endl;
  cout.flush();
  exit(0);
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (long long i = (1), iE = (n); i <= iE; i++)
    if (!vis[i]) bfs(i);
  for (long long i = (1), iE = (n); i <= iE; i++)
    if (dep[i]) q.push_back(i);
  t.clear(), s.clear();
  for (long long i = (1), iE = (n); i <= iE; i++)
    if (dep[i] & 1)
      s.push_back(i);
    else
      t.push_back(i);
  if (query1(s)) printno(s);
  if (query1(t)) printno(t);
  cout << "Y " << s.size() << endl;
  for (long long u : s) cout << u << " ";
  cout << endl;
}
