#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
using namespace std;
long long n;
long long pr[((long long)(2e6 + 600))];
long long f[((long long)(2e6 + 600))];
vector<long long> sa;
long long ask(vector<long long> v) {
  if (v.size() <= 1) return 0;
  cout << "? " << v.size() << endl;
  for (auto x : v) cout << x << " ";
  cout << endl;
  long long k;
  cin >> k;
  return k;
}
void end(long long k, long long p) {
  vector<long long> v, v1;
  if (f[k] < f[p]) swap(k, p);
  while (f[k] > f[p]) v.push_back(k), k = pr[k];
  while (k != p) {
    v.push_back(k);
    v1.push_back(p);
    k = pr[k];
    p = pr[p];
  }
  v1.push_back(k);
  reverse(v.begin(), v.end());
  for (auto x : v1) v.push_back(x);
  cout << "N " << v.size() << endl;
  for (auto x : v) cout << x << " ";
  cout << endl;
  exit(0);
}
long long fx(long long x) {
  vector<long long> t;
  for (int i = 1; i <= n; i++) {
    if (!f[i]) t.push_back(i);
  }
  long long l = 0, r = t.size();
  while (l < r) {
    long long m = l + r >> 1;
    vector<long long> q;
    for (int i = 0; i <= m; i++) q.push_back(t[i]);
    long long k = ask(q);
    q.push_back(x);
    long long p = ask(q);
    if (p - k)
      r = m;
    else
      l = m + 1;
  }
  if (l == t.size())
    return 0;
  else
    return t[l];
}
void go(long long x, long long y, long long d) {
  if (d & 1) sa.push_back(x);
  pr[x] = y;
  vector<long long> t;
  for (int i = 1; i <= n; i++) {
    if (f[i] && f[i] % 2 == d % 2) t.push_back(i);
  }
  f[x] = d;
  long long k = ask(t);
  t.push_back(x);
  long long p = ask(t);
  if (p - k) {
    long long w = p - k;
    while (1) {
      t.pop_back();
      long long c = t[t.size() - 1];
      t.pop_back();
      k = ask(t);
      t.push_back(x);
      p = ask(t);
      if (p - k != w) end(x, c);
    }
  }
  while (1) {
    long long k = fx(x);
    if (!k) break;
    go(k, x, d + 1);
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin >> n;
  go(1, 0, 1);
  cout << "Y " << sa.size() << endl;
  for (auto x : sa) cout << x << " ";
  cout << endl;
}
