#include <bits/stdc++.h>
using namespace std;
bool e[601][601];
int n;
vector<pair<int, int>> es;
vector<int> w[601];
int t(int i) {
  if (i > n) return i - n;
}
unordered_map<string, int> mp;
int get(vector<int> q) {
  if (q.size() <= 1) return 0;
  sort(q.begin(), q.end());
  string s;
  for (int i : q) s += to_string(i) + "|";
  if (mp.count(s)) return mp[s];
  cout << "? " << q.size() << endl;
  for (int i : q) cout << i << " ";
  cout << endl;
  int x;
  cin >> x;
  mp[s] = x;
  return x;
}
void solve(vector<int> v) {
  if (v.size() <= 1) return;
  vector<int> x;
  vector<int> y;
  for (int i = 0; i < v.size() / 2; i++) x.push_back(v[i]);
  for (int i = v.size() / 2; i < v.size(); i++) y.push_back(v[i]);
  int xs = get(x);
  int ys = get(y);
  int all = get(v);
}
pair<int, int> findOne(vector<int> v, vector<int> w) {
  if (v.empty()) return {0, 0};
  if (w.empty()) return {0, 0};
  int xs = get(v);
  int ys = get(w);
  vector<int> q = v;
  for (int i : w) q.push_back(i);
  int all = get(q);
  if (xs + ys == all) {
    return {0, 0};
  }
  if (v.size() == 1 && w.size() == 1) return {v[0], w[0]};
  vector<int> xx, xy, yx, yy;
  for (int i = 0; i < v.size() / 2; i++) xx.push_back(v[i]);
  for (int i = v.size() / 2; i < v.size(); i++) xy.push_back(v[i]);
  for (int i = 0; i < w.size() / 2; i++) yx.push_back(w[i]);
  for (int i = w.size() / 2; i < w.size(); i++) yy.push_back(w[i]);
  pair<int, int> p = findOne(xx, yx);
  if (p.first != 0) return p;
  p = findOne(xx, yy);
  if (p.first != 0) return p;
  p = findOne(xy, yx);
  if (p.first != 0) return p;
  p = findOne(xy, yy);
  if (p.first != 0) return p;
}
bool gi[601];
int mc[601];
void color(int i, int c) {
  if (mc[i]) return;
  mc[i] = c;
  for (int j : w[i]) {
    color(j, 3 - c);
  }
}
vector<int> lol;
void path(int i, int t) {
  if (lol.size() >= 2 && lol[lol.size() - 2] == i) return;
  lol.push_back(i);
  if (i == t) {
    cout << lol.size() << endl;
    for (int i : lol) cout << i << " ";
    cout << endl;
    exit(0);
  }
  for (int j : w[i]) {
    path(j, t);
  }
  lol.pop_back();
}
int main() {
  srand(time(0));
  cin >> n;
  vector<vector<int>> v;
  for (int i = 1; i <= n; i++) v.push_back({i});
  while (v.size() > 1) {
    vector<int> x = v.back();
    for (int i : x) gi[i] = 1;
    vector<int> y;
    for (int i = 1; i <= n; i++) {
      if (!gi[i]) y.push_back(i);
    }
    pair<int, int> p = findOne(x, y);
    w[p.first].push_back(p.second);
    w[p.second].push_back(p.first);
    v.pop_back();
    for (vector<int> &q : v) {
      for (int j : q) {
        if (j == p.first || j == p.second) {
          for (int i : x) q.push_back(i);
          goto end;
        }
      }
    }
  end:;
    for (int i : x) gi[i] = 0;
  }
  color(1, 1);
  vector<int> on, tw;
  for (int i = 1; i <= n; i++) {
    if (mc[i] == 1)
      on.push_back(i);
    else if (mc[i] == 2)
      tw.push_back(i);
  }
  if (get(on)) {
    while (true) {
      random_shuffle(on.begin(), on.end());
      vector<int> x, y;
      for (int i = 0; i < on.size() / 2; i++) x.push_back(on[i]);
      for (int i = on.size() / 2; i < on.size(); i++) y.push_back(on[i]);
      pair<int, int> p = findOne(x, y);
      if (p.first == 0) continue;
      cout << "N ";
      path(p.first, p.second);
    }
  }
  if (get(tw)) {
    while (true) {
      random_shuffle(tw.begin(), tw.end());
      vector<int> x, y;
      for (int i = 0; i < tw.size() / 2; i++) x.push_back(tw[i]);
      for (int i = tw.size() / 2; i < tw.size(); i++) y.push_back(tw[i]);
      pair<int, int> p = findOne(x, y);
      if (p.first == 0) continue;
      cout << "N ";
      path(p.first, p.second);
    }
  }
  cout << "Y " << on.size() << endl;
  for (int i : on) cout << i << " ";
  cout << endl;
}
