#include <bits/stdc++.h>
using namespace std;
template <class TH>
void _dbg(const char *sdbg, TH h) {
  cerr << sdbg << " = " << h << endl;
}
template <class TH, class... TA>
void _dbg(const char *sdbg, TH h, TA... a) {
  while (*sdbg != ',') cerr << *sdbg++;
  cerr << " = " << h << ", ";
  _dbg(sdbg + 1, a...);
}
const int maxn = (1e6) + 7;
const int maxk = 20;
const int inf = (1e9) + 7;
const long long LLinf = ((long long)1e18) + 7LL;
const long double eps = 1e-9;
const long long mod = 1e9 + 7;
int F[maxn];
vector<int> pozo, cur;
vector<int> wek[maxn];
int deep[maxn];
vector<int> V[10];
void dfs(int x) {
  for (auto s : wek[x])
    if (deep[s] == 0) {
      deep[s] = deep[x] + 1;
      dfs(s);
    }
}
void ae(int a, int b) {
  wek[a].push_back(b);
  wek[b].push_back(a);
}
int pyt(vector<int> xd) {
  cout << "? " << ((int)(xd).size()) << endl;
  for (auto s : xd) cout << s << " ";
  cout << endl;
  int a;
  cin >> a;
  return a;
}
int pytanko(vector<int> xd, vector<int> xd2) {
  for (auto s : xd2) xd.push_back(s);
  return pyt(xd);
}
int zap(vector<int> cnt, int ile) {
  vector<int> dwa;
  for (int i = 0; i <= ile; i++) dwa.push_back(pozo[i]);
  return pytanko(cnt, dwa) - pyt(dwa);
}
vector<int> stos;
int dest;
bool vis[maxn];
void d(int x) {
  stos.push_back(x);
  if (x == dest) {
    cout << "N " << ((int)(stos).size()) << endl;
    for (auto s : stos) cout << s << " ";
    cout << endl;
    exit(0);
  }
  vis[x] = 1;
  for (auto s : wek[x])
    if (vis[s] == 0) {
      d(s);
    }
  stos.pop_back();
}
vector<int> pref;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  if (n == 1) {
    cout << "Y 1\n1";
    return 0;
  }
  for (int i = 2; i <= n; i++) pozo.push_back(i);
  cur.push_back(1);
  pref.push_back(0);
  while (((int)(pozo).size())) {
    int ile = pyt(cur);
    int l = -1;
    int p = ((int)(pozo).size()) - 1;
    while (l + 1 < p) {
      int sr = (l + p) / 2;
      if (zap(cur, sr) > ile)
        p = sr;
      else
        l = sr;
    }
    int kto = pozo[p];
    swap(pozo[p], pozo.back());
    pozo.pop_back();
    l = -1;
    p = ((int)(cur).size());
    while (l + 1 < p) {
      int sr = (l + p) / 2;
      vector<int> xd;
      for (int i = 0; i <= sr; i++) xd.push_back(cur[i]);
      if (pytanko(xd, {kto}) > pref[sr])
        p = sr;
      else
        l = sr;
    }
    ae(kto, cur[p]);
    cur.push_back(kto);
    pref.push_back(pyt(cur));
  }
  deep[1] = 1;
  dfs(1);
  for (int i = 1; i <= n; i++) V[deep[i] & 1].push_back(i);
  if (pyt(V[0]) == 0 && pyt(V[1]) == 0) {
    cout << "Y " << ((int)(V[0]).size()) << endl;
    for (auto s : V[0]) cout << s << " ";
    cout << endl;
    return 0;
  }
  if (pyt(V[0]) == 0) swap(V[0], V[1]);
  while (((int)(V[0]).size()) > 2) {
    int ost = V[0].back();
    V[0].pop_back();
    if (pyt(V[0]) == 0) {
      for (auto v : V[0])
        if (pyt({v, ost}) > 0) {
          V[0] = {v, ost};
          break;
        }
    }
  }
  dest = V[0][1];
  d(V[0][0]);
  return 0;
}
