#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
void pre() {}
void solve() {}
vector<pair<vector<int>, vector<int>>> v;
map<vector<int>, int> str;
int qry(vector<int> q) {
  if ((int)(q).size() < 2) return 0;
  sort(q.begin(), q.end());
  if (str.find(q) != str.end()) return str[q];
  cout << "? " << (int)(q).size() << "\n";
  for (auto& i : q) cout << i << ' ';
  cout << endl;
  int x;
  cin >> x;
  return str[q] = x;
}
int cal(vector<int> q, int i, int fg) {
  for (int j = 0; j < (i); ++j) {
    if (!fg)
      for (auto& k : v[j].first) q.push_back(k);
    else
      for (auto& k : v[j].second) q.push_back(k);
  }
  return qry(q);
}
int que(vector<int> a) {
  vector<int> q = a, q2;
  for (auto& i : v) {
    for (auto& j : i.first) q.push_back(j), q2.push_back(j);
  }
  if (qry(q) == qry(q2)) {
    q = a, q2.clear();
    for (auto& i : v) {
      for (auto& j : i.second) q.push_back(j), q2.push_back(j);
    }
    if (qry(q) == qry(q2)) return -1;
    int lo = 0, hi = (int)(v).size() - 1;
    while (lo < hi) {
      int m = (lo + hi) / 2;
      q = a;
      int aa = cal(q, m + 1, 1);
      q.clear();
      int bb = cal(q, m + 1, 1);
      if (aa == bb)
        lo = m + 1;
      else
        hi = m;
    }
    return lo;
  }
  int lo = 0, hi = (int)(v).size() - 1;
  while (lo < hi) {
    int m = (lo + hi) / 2;
    q = a;
    int aa = cal(q, m + 1, 0);
    q.clear();
    int bb = cal(q, m + 1, 0);
    if (aa == bb)
      lo = m + 1;
    else
      hi = m;
  }
  return lo;
}
int qe(vector<int> a, vector<int> b) {
  vector<int> q;
  for (auto& i : a) q.push_back(i);
  for (auto& i : b) q.push_back(i);
  return qry(q);
}
vector<int> g[609];
bool vis[609];
int p[609], l[609];
vector<int> cycle;
void dfs(int u, int v, int h) {
  vis[u] = 1;
  p[u] = v;
  l[u] = h;
  for (auto& i : g[u]) {
    if (!vis[i]) {
      dfs(i, u, 1 - h);
    } else if (l[i] == l[u]) {
      vector<int> a, b;
      while (p[u] != -1) a.push_back(u), u = p[u];
      a.push_back(u);
      while (p[i] != -1) b.push_back(i), i = p[i];
      reverse(b.begin(), b.end());
      for (auto& i : b) a.push_back(i);
      cout << "N " << (int)(a).size() << '\n';
      for (auto& i : a) cout << i << ' ';
      cout << endl;
      exit(0);
    }
  }
}
void conn(vector<int> a) {
  dfs(a[0], -1, 0);
  for (auto& i : a)
    if (!vis[i]) exit(-1);
  memset(vis, 0, sizeof(vis));
}
void join(vector<int> a, vector<int> b) {
  vector<int> q;
  int lo = 0, hi = (int)(a).size() - 1;
  while (lo < hi) {
    int m = (lo + hi) / 2;
    vector<int> q = b;
    for (int i = 0; i < (m + 1); ++i) q.push_back(a[i]);
    if (qry(q))
      hi = m;
    else
      lo = m + 1;
  }
  vector<int> aa = a;
  int x = a[lo];
  a.clear();
  a.push_back(x);
  swap(a, b);
  lo = 0, hi = (int)(a).size() - 1;
  while (lo < hi) {
    int m = (lo + hi) / 2;
    vector<int> q = b;
    for (int i = 0; i < (m + 1); ++i) q.push_back(a[i]);
    if (qry(q))
      hi = m;
    else
      lo = m + 1;
  }
  g[b[0]].push_back(a[lo]);
  g[a[lo]].push_back(b[0]);
}
void odd_cycle(bool fg) {
  int ix = 0;
  vector<int> kk;
  for (int i = 1; i <= (600); ++i) {
    if ((int)(g[i]).size() && !vis[i]) {
      kk.push_back(i);
      ix++;
      p[i] = -1;
      dfs(i, -1, 0);
    }
  }
}
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  cin.exceptions(cin.failbit);
  pre();
  int n;
  cin >> n;
  v.resize(n);
  for (int i = 0; i < (n); ++i) v[i].first.push_back(i + 1);
  vector<int> l, r;
  while ((int)(v).size()) {
    vector<int> x = v.back().first, y = v.back().second;
    v.pop_back();
    int i = que(x);
    if (i == -1) {
      i = que(y);
    }
    if (i == -1) {
      for (auto& i : x) l.push_back(i);
      for (auto& i : y) r.push_back(i);
    } else {
      int a1 = qe(x, v[i].first), a2 = qe(x, v[i].second),
          a3 = qe(y, v[i].first), a4 = qe(y, v[i].second);
      if (a1) join(x, v[i].first);
      if (a2) join(x, v[i].second);
      if (a3) join(y, v[i].first);
      if (a4) join(y, v[i].second);
      if (a2 == 0 && a3 == 0) {
        for (auto& j : x) v[i].second.push_back(j);
        for (auto& j : y) v[i].first.push_back(j);
      } else if (a1 == 0 && a4 == 0) {
        for (auto& j : x) v[i].first.push_back(j);
        for (auto& j : y) v[i].second.push_back(j);
      } else {
        odd_cycle(n == 599);
        exit(0);
      }
    }
  }
  cout << "Y " << (int)(l).size() << '\n';
  for (auto& i : l) cout << i << ' ';
  cout << endl;
  return 0;
}
