#include <bits/stdc++.h>
using namespace std;
const int kr = 600;
int n, up[602], sg[602];
vector<int> v[2], ve[602];
map<vector<int>, int> vmp;
void va(bool a, int b) {
  bool bo = 0;
  for (int i = 0; i < v[a].size(); ++i) {
    if (bo)
      v[a][i - 1] = v[a][i];
    else if (v[a][i] == b)
      bo = 1;
  }
  if (bo) v[a].pop_back();
}
void cn(int &a) {
  cin >> a;
  if (a == -1) {
    exit(0);
  }
}
int kd(int pp, int mp) {
  if (pp > v[0].size() || mp > v[1].size()) exit(0);
  if (pp + mp <= 1) return 0;
  vector<int> V;
  if (pp + mp <= kr) {
    for (int i = 0; i < pp; ++i) {
      V.push_back(v[0][i]);
    }
    for (int i = 0; i < mp; ++i) {
      V.push_back(v[1][i]);
    }
    sort(V.begin(), V.end());
    if (vmp.find(V) != vmp.end()) {
      return vmp[V];
    }
  }
  cout << "? " << pp + mp << endl;
  for (int i = 0; i < pp; ++i) {
    cout << v[0][i] << " ";
  }
  for (int i = 0; i < mp; ++i) {
    cout << v[1][i] << " ";
  }
  cout << endl;
  int tts;
  cn(tts);
  if (pp + mp <= kr) {
    vmp[V] = tts;
  }
  return tts;
}
int kdd(int a, int b) {
  cout << "? " << a + 1 << endl;
  for (int i = 0; i < a; ++i) {
    cout << v[0][i] << " ";
  }
  cout << v[0][b] << endl;
  int tts;
  cn(tts);
  return tts;
}
void kdg() {
  cout << "Y " << v[0].size() << endl;
  for (int i : v[0]) cout << i << " ";
  cout << endl;
  exit(0);
}
void ndg(int a, int b) {
  if (sg[a] < sg[b]) swap(a, b);
  vector<int> V[2];
  while (sg[a] > sg[b]) {
    V[0].push_back(a);
    a = up[a];
  }
  while (a != b) {
    V[0].push_back(a);
    V[1].push_back(b);
    a = up[a];
    b = up[b];
  }
  V[0].push_back(a);
  cout << "N " << (int)V[0].size() + (int)V[1].size() << endl;
  for (int i : V[0]) cout << i << " ";
  reverse(V[1].begin(), V[1].end());
  for (int i : V[1]) cout << i << " ";
  cout << endl;
  exit(0);
}
void ewa() {
  int pr = kd(v[0].size(), 0), l = 1, r = v[1].size(), mi;
  while (l <= r) {
    int m = (l + r) / 2, aosk = kd(v[0].size(), m) - kd(0, m) - pr;
    if (aosk) {
      r = m - 1;
      mi = m;
    } else {
      l = m + 1;
    }
  }
  int pi;
  pr = kd(0, mi);
  l = 1, r = v[0].size();
  while (l <= r) {
    int m = (l + r) / 2, aosk = kd(m, mi) - kd(m, 0) - pr;
    if (aosk) {
      r = m - 1;
      pi = m - 1;
    } else {
      l = m + 1;
    }
  }
  --mi;
  up[v[1][mi]] = v[0][pi];
  ve[v[0][pi]].push_back(v[1][mi]);
  v[0].push_back(v[1][mi]);
  v[1].erase(v[1].begin() + mi);
}
void gnw(int dg) {
  sg[dg] = sg[up[dg]] + 1;
  v[sg[dg] & 1].push_back(dg);
  for (int i : ve[dg]) gnw(i);
}
void spn() {
  if (!kd(v[0].size(), 0)) return;
  int l = 1, r = v[0].size(), pbm;
  while (l <= r) {
    int m = (l + r) / 2;
    if (kd(m, 0)) {
      r = pbm = m - 1;
    } else {
      l = m + 1;
    }
  }
  l = 1, r = pbm;
  int pbc;
  while (l <= r) {
    int m = (l + r) / 2;
    if (kdd(m, pbm)) {
      r = pbc = m - 1;
    } else {
      l = m + 1;
    }
  }
  ndg(v[0][pbc], v[0][pbm]);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  v[0].push_back(1);
  for (int i = 2; i <= n; ++i) v[1].push_back(i);
  for (int i = 1; i < n; ++i) ewa();
  v[0].clear();
  gnw(1);
  spn();
  swap(v[0], v[1]);
  spn();
  kdg();
  return 0;
}
