#include <bits/stdc++.h>
int suma, unde;
int A[602], B[602];
int niv[602][602], vecA[602], vecB[602];
bool vizA[602], vizB[602], done[602];
inline void prost() {
  while (1)
    ;
}
inline int calc2(int v[], int left, int right, int st, int dr) {
  printf("? %d\n", right - left + dr - st + 2);
  for (int i = left; i <= right; i++) printf("%d ", v[i]);
  for (int i = st; i <= dr; i++) printf("%d ", v[i]);
  printf("\n");
  fflush(stdout);
  int ans;
  scanf("%d", &ans);
  if (ans == -1) prost();
  return ans;
}
inline int calc(int v[], int left, int right) {
  if (left == right) return 0;
  printf("? %d\n", right - left + 1);
  for (int i = left; i <= right; i++) printf("%d ", v[i]);
  printf("\n");
  fflush(stdout);
  int ans;
  scanf("%d", &ans);
  if (ans == -1) prost();
  return ans;
}
inline bool ceva(int left, int right) {
  int aux = calc(B, left, right);
  printf("? %d\n", A[0] + right - left + 1);
  for (int i = 1; i <= A[0]; i++) printf("%d ", A[i]);
  for (int i = left; i <= right; i++) printf("%d ", B[i]);
  printf("\n");
  fflush(stdout);
  int ans;
  scanf("%d", &ans);
  if (ans == -1) prost();
  return ans - suma - aux > 0;
}
inline bool checkNiv() {
  if (niv[unde][0] == 0) return 0;
  if (calc(niv[unde], 1, niv[unde][0])) return 0;
  return 1;
}
void dfs(int st, int dr) {
  if (st == dr) {
    done[B[st]] = 1;
    niv[unde][++niv[unde][0]] = B[st];
  } else {
    int m = (st + dr) / 2;
    if (ceva(st, m)) {
      dfs(st, m);
      if (ceva(m + 1, dr)) dfs(m + 1, dr);
    } else
      dfs(m + 1, dr);
  }
}
inline bool muchie(int nod, int v[], int st, int dr) {
  printf("? %d\n", dr - st + 2);
  for (int i = st; i <= dr; i++) printf("%d ", v[i]);
  printf("%d\n", nod);
  fflush(stdout);
  int ans;
  scanf("%d", &ans);
  if (ans == -1) prost();
  return ans;
}
void go(int nod, bool viz[], int v[], int st, int dr) {
  if (st == dr)
    viz[v[st]] = 1;
  else {
    int m = (st + dr) / 2;
    if (muchie(nod, v, st, m)) {
      go(nod, viz, v, st, m);
      if (muchie(nod, v, m + 1, dr)) go(nod, viz, v, m + 1, dr);
    } else
      go(nod, viz, v, m + 1, dr);
  }
}
inline void findCiclu() {
  int st = 1, dr = niv[unde][0];
  bool ok = 1;
  while (ok) {
    int m = (st + dr) / 2;
    if (calc(niv[unde], st, m))
      dr = m;
    else if (calc(niv[unde], m + 1, dr))
      st = m + 1;
    else
      ok = 0;
  }
  ok = 1;
  int left = st, right = (st + dr) / 2;
  st = right + 1;
  while (st < dr) {
    int m = (st + dr) / 2;
    if (calc2(niv[unde], left, right, st, m))
      dr = m;
    else
      st = m + 1;
  }
  while (left < right) {
    int m = (left + right) / 2;
    if (calc2(niv[unde], left, m, st, dr))
      right = m;
    else
      left = m + 1;
  }
  int nodulA = niv[unde][left], nodulB = niv[unde][st];
  ok = 1;
  int poz = unde - 1, rad = 0;
  while (ok) {
    vecA[++vecA[0]] = nodulA;
    vecB[++vecB[0]] = nodulB;
    go(nodulA, vizA, niv[poz], 1, niv[poz][0]);
    go(nodulB, vizB, niv[poz], 1, niv[poz][0]);
    for (int i = 1; i <= niv[poz][0]; i++)
      if (vizA[niv[poz][i]] && vizB[niv[poz][i]])
        rad = niv[poz][i], ok = 0;
      else if (vizA[niv[poz][i]])
        nodulA = niv[poz][i];
      else if (vizB[niv[poz][i]])
        nodulB = niv[poz][i];
    poz--;
  }
  printf("N %d\n", 2 * vecA[0] + 1);
  for (int i = 1; i <= vecA[0]; i++) printf("%d ", vecA[i]);
  printf("%d", rad);
  for (int i = vecB[0]; i > 0; i--) printf(" %d", vecB[i]);
  printf("\n");
}
int main() {
  int n;
  scanf("%d", &n);
  niv[0][++niv[0][0]] = 1;
  done[1] = 1;
  while (checkNiv()) {
    unde++;
    A[0] = B[0] = 0;
    for (int i = 1; i <= n; i++)
      if (done[i])
        A[++A[0]] = i;
      else
        B[++B[0]] = i;
    suma = calc(A, 1, A[0]);
    if (B[0] > 0) dfs(1, B[0]);
  }
  if (niv[unde][0] == 0) {
    for (int i = 1; i <= n; i++)
      if (done[i] == 0) prost();
    int ans = 0;
    for (int i = 0; i < unde; i += 2) ans += niv[i][0];
    printf("Y %d\n", ans);
    for (int i = 0; i < unde; i += 2)
      for (int j = 1; j <= niv[i][0]; j++) printf("%d ", niv[i][j]);
    printf("\n");
  } else
    findCiclu();
  return 0;
}
