#include <bits/stdc++.h>
using namespace std;
const int INF = 1000 * 1000 * 1000;
const long long LINF = 1LL * INF * INF;
const int MAX = 607;
const double PI = acos(-1.);
const double EPS = 1e-8;
int E[MAX][MAX];
int cnt = 0;
int ask(vector<int> a) {
  if ((int)a.size() <= 1) return 0;
  ++cnt;
  cout << "? " << (int)a.size() << endl;
  for (int i = 0; i < (int)a.size(); ++i) {
    cout << a[i] + 1 << ' ';
  }
  cout << endl;
  cout.flush();
  int val = 0;
  cin >> val;
  if (val == -1) throw -1;
  return val;
}
vector<int> G[MAX];
int C[MAX];
int P[MAX];
void dfs(int v, int p, int c) {
  C[v] = c;
  P[v] = p;
  for (int i = 0; i < (int)G[v].size(); ++i) {
    int to = G[v][i];
    if (to == p) continue;
    dfs(to, v, c ^ 1);
  }
}
int main() {
  int n;
  cin >> n;
  vector<int> A;
  vector<int> B;
  A.push_back(0);
  for (int i = 1; i < n; ++i) {
    B.push_back(i);
  }
  for (int it = 0; it < n - 1; ++it) {
    int L = 0;
    int R = (int)B.size() - 1;
    int edgesA = ask(A);
    while (R != L) {
      int m = (L + R) / 2;
      vector<int> X;
      for (int t = L; t < m + 1; ++t) X.push_back(B[t]);
      int edgesX = ask(X);
      for (int t = 0; t < (int)A.size(); ++t) X.push_back(A[t]);
      int edgesAX = ask(X);
      if (edgesAX == edgesA + edgesX) {
        L = m + 1;
      } else {
        R = m;
      }
    }
    int idB = L;
    L = 0;
    R = (int)A.size() - 1;
    while (R != L) {
      int m = (L + R) / 2;
      vector<int> X;
      for (int t = L; t < m + 1; ++t) X.push_back(A[t]);
      int edgesX = ask(X);
      X.push_back(B[idB]);
      int edgesBX = ask(X);
      if (edgesBX == edgesX) {
        L = m + 1;
      } else {
        R = m;
      }
    }
    int idA = L;
    int v = A[idA];
    int to = B[idB];
    G[v].push_back(to);
    G[to].push_back(v);
    swap(B[idB], B.back());
    B.pop_back();
    A.push_back(to);
  }
  dfs(0, -1, 0);
  A.clear();
  B.clear();
  for (int i = 0; i < n; ++i) {
    if (C[i] == 0)
      A.push_back(i);
    else
      B.push_back(i);
  }
  if (ask(A) == 0 && ask(B) == 0) {
    cout << "Y " << (int)A.size() << endl;
    for (int i = 0; i < (int)A.size(); ++i) {
      cout << A[i] + 1 << ' ';
    }
    cout << endl;
    cout.flush();
    return 0;
  }
  if (ask(B) != 0) {
    swap(A, B);
  }
  int a = -1;
  int b = -1;
  while (true) {
    if ((int)A.size() == 2) {
      a = A[0];
      b = A[1];
      break;
    }
    int last = A.back();
    A.pop_back();
    if (ask(A) == 0) {
      a = last;
      for (int i = 0; i < (int)A.size(); ++i) {
        vector<int> X;
        X.push_back(a);
        X.push_back(A[i]);
        if (ask(X) != 0) {
          b = A[i];
          break;
        }
      }
      break;
    }
  }
  dfs(a, -1, 0);
  vector<int> path;
  while (b != a) {
    path.push_back(b);
    b = P[b];
  }
  path.push_back(a);
  reverse(path.begin(), path.end());
  cout << "N " << (int)path.size() << endl;
  for (int i = 0; i < (int)path.size(); ++i) {
    cout << path[i] + 1 << ' ';
  }
  cout << endl;
  return 0;
}
