#include <bits/stdc++.h>
using namespace std;
const int nmax = 600;
int n, m;
bool in_tree[nmax + 1];
vector<int> g[nmax + 1];
map<unsigned long long, int> mp;
inline unsigned long long hsh(vector<int> &v) {
  sort(v.begin(), v.end());
  unsigned long long s = 0;
  for (auto i : v) s = s * 601 + i;
  return s;
}
int ask(vector<int> v) {
  if (v.size() <= 1) return 0;
  if ((int)v.size() == n && m > 0) return m;
  unsigned long long key = hsh(v);
  if (mp.find(key) != mp.end()) return mp[key];
  fprintf(stdout, "? %d\n", (int)v.size());
  for (auto i : v) fprintf(stdout, "%d ", i);
  fprintf(stdout, "\n");
  fflush(stdout);
  int x;
  fscanf(stdin, "%d", &x);
  if (x == -1) exit(0);
  mp[key] = x;
  return x;
}
vector<int> operator+(const vector<int> &a, const vector<int> &b) {
  vector<int> aux;
  for (auto i : a) aux.push_back(i);
  for (auto i : b) aux.push_back(i);
  sort(aux.begin(), aux.end());
  aux.erase(unique(aux.begin(), aux.end()), aux.end());
  return aux;
}
int totalb;
vector<int> shp;
void divide(vector<int> &a, vector<int> &b) {
  if (a.size() <= 1) {
    return;
  }
  shp = a;
  shp.resize(a.size() / 2);
  if (ask(shp + b) - totalb - ask(shp) >= 1) {
    a = shp;
  } else {
    shp.clear();
    for (int i = a.size() / 2; i < (int)a.size(); ++i) shp.push_back(a[i]);
    a = shp;
  }
  divide(a, b);
}
pair<int, int> solve(vector<int> &a, vector<int> &b) {
  totalb = ask(b);
  divide(a, b);
  totalb = 0;
  divide(b, a);
  return {a[0], b[0]};
}
vector<int> mij;
pair<int, int> special_edge(vector<int> &a) {
  mij = a;
  mij.resize(a.size() / 2);
  if (ask(mij) >= 1) {
    a = mij;
    return special_edge(a);
  } else {
    shp.clear();
    for (int i = a.size() / 2; i < (int)a.size(); ++i) shp.push_back(a[i]);
    if (ask(shp) >= 1) {
      a = shp;
      return special_edge(a);
    } else {
      a = shp;
      return solve(mij, a);
    }
  }
}
int h[nmax + 1], dad[nmax + 1];
bool viz[nmax + 1];
void dfs(int node) {
  viz[node] = 1;
  for (auto i : g[node]) {
    if (viz[i] == 0) {
      h[i] = h[node] + 1;
      dad[i] = node;
      dfs(i);
    }
  }
}
int main() {
  fscanf(stdin, "%d", &n);
  vector<int> all(n);
  for (int i = 0; i < n; ++i) all[i] = i + 1;
  m = ask(all);
  in_tree[1] = 1;
  for (int i = 2; i <= n; ++i) {
    vector<int> tree, oth;
    for (int j = 1; j <= n; ++j) {
      if (in_tree[j] == 1)
        tree.push_back(j);
      else
        oth.push_back(j);
    }
    pair<int, int> edge = solve(tree, oth);
    g[edge.first].push_back(edge.second);
    g[edge.second].push_back(edge.first);
    in_tree[edge.first] = in_tree[edge.second] = 1;
  }
  dfs(1);
  vector<int> vh[2];
  for (int i = 1; i <= n; ++i) vh[h[i] % 2].push_back(i);
  int m0 = ask(vh[0]);
  if (m0 == 0 && ask(vh[1]) == 0) {
    fprintf(stdout, "Y %d\n", (int)vh[0].size());
    for (auto i : vh[0]) fprintf(stdout, "%d ", i);
    fprintf(stdout, "\n");
    fflush(stdout);
    exit(0);
  }
  if (m0 == 0) swap(vh[1], vh[0]);
  pair<int, int> e = special_edge(vh[0]);
  h[e.first] = 0;
  memset(viz, 0, sizeof(viz));
  dfs(e.first);
  vector<int> cycle;
  if (h[e.first] < h[e.second]) swap(e.first, e.second);
  while (e.first != e.second) {
    cycle.push_back(e.first);
    e.first = dad[e.first];
  }
  cycle.push_back(e.second);
  fprintf(stdout, "N %d\n", (int)cycle.size());
  for (auto i : cycle) fprintf(stdout, "%d ", i);
  fprintf(stdout, "\n");
  fflush(stdout);
  return 0;
}
