#include <bits/stdc++.h>
using namespace std;
const int N = 200 * 1000 + 20;
const int N5 = 300 * 1000 + 10;
const int N3 = 5000 + 20;
const long long mod = 1000 * 1000 * 1000 + 7;
const long long inf = INT_MAX;
vector<int> vec, d[N], vect;
deque<int> cy0, cy1;
int h = 1, mark[N], all;
void binary(int l, int r) {
  cout << "? " << r - l << endl;
  for (int i = l; i < r; i++) {
    cout << vec[i] << " ";
  }
  cout << endl;
  int ans1, ans2;
  cin >> ans1;
  cout << "? " << r - l + d[h - 1].size() << "\n";
  for (auto x : d[h - 1]) cout << x << " ";
  for (int i = l; i < r; i++) {
    cout << vec[i] << " ";
  }
  cout << endl;
  cin >> ans2;
  ans1 = ans2 - ans1;
  if (ans1 == 0) {
    return;
  }
  if (r - l <= 1) {
    mark[vec[l]] = 1;
    d[h].push_back(vec[l]);
    return;
  }
  int mid = (l + r) / 2;
  binary(mid, r);
  binary(l, mid);
}
int deg(int a) {
  cout << "? " << d[h].size() - 1 << endl;
  for (auto x : d[h])
    if (x != a) cout << x << " ";
  cout << endl;
  int ans;
  cin >> ans;
  return all - ans;
}
bool adj(int a, int b) {
  cout << "? " << 2 << endl << a << " " << b << endl;
  int ans;
  cin >> ans;
  return (ans == 1);
}
void odd_cycle() {
  int a, b;
  for (auto x : d[h]) {
    if (deg(x) != 0) {
      a = x;
      break;
    }
  }
  for (auto x : d[h]) {
    if (a != x and adj(a, x)) {
      b = x;
      break;
    }
  }
  h--;
  while (a != b) {
    cy0.push_back(a);
    cy1.push_front(b);
    for (auto x : d[h]) {
      if (adj(a, x)) {
        a = x;
      }
    }
    for (auto x : d[h]) {
      if (adj(b, x)) {
        b = x;
      }
    }
    h--;
  }
  cy0.push_back(a);
  cout << "N " << cy0.size() + cy1.size() << endl;
  for (auto x : cy0) {
    cout << x << " ";
  }
  for (auto x : cy1) {
    cout << x << " ";
  }
  cout << endl;
}
int main() {
  int n;
  cin >> n;
  for (int i = 2; i <= n; i++) {
    vec.push_back(i);
  }
  d[0].push_back(1);
  while (!vec.empty()) {
    binary(0, vec.size());
    vec.clear();
    for (int i = 2; i <= n; i++) {
      if (!mark[i]) vec.push_back(i);
    }
    cout << "? " << d[h].size() << endl;
    for (auto x : d[h]) cout << x << " ";
    cout << endl;
    int ans;
    cin >> ans;
    all = ans;
    if (ans > 0) {
      odd_cycle();
      return 0;
    }
    h++;
  }
  for (int i = 0; i < h; i += 2) {
    for (auto x : d[i]) vect.push_back(x);
  }
  cout << "Y " << vect.size() << endl;
  for (auto x : vect) cout << x << " ";
  cout << endl;
}
