#include <bits/stdc++.h>
using namespace std;
int u1[610], u2[610], f[610];
vector<int> v1, v2, e[610];
int ans[610];
bool v[610];
bool dfs(int x, int y, int d) {
  ans[d++] = x;
  v[x] = true;
  if (x == y) {
    cout << "N " << d << "\n";
    for (int i = 0; i < d; i++) cout << ans[i] << " ";
    cout << "\n";
    cout.flush();
    return true;
  }
  for (int i = 0; i < e[x].size(); i++)
    if (!v[e[x][i]])
      if (dfs(e[x][i], y, d)) return true;
  return false;
}
int main() {
  int ask = 0;
  int n, t, t1, t2, t0;
  cin >> n;
  if (n == 1) {
    cout << "Y 1\n1\n";
    cout.flush();
    return 0;
  }
  int n1 = 0, n2 = 0;
  u1[n1++] = 1;
  f[1] = 0;
  for (int i = 2; i <= n; i++) u2[n2++] = i;
  while (n2 > 0) {
    if (n1 > 1) {
      cout << "? " << n1 << "\n";
      for (int i = 0; i < n1; i++) cout << u1[i] << " ";
      cout << "\n";
      cout.flush();
      cin >> t1;
      ask++;
      if (ask == 19999) {
        cout << "here6\n";
        cout.flush();
        return 0;
      }
    } else
      t1 = 0;
    int l2 = 0, r2 = n2 - 1;
    while (l2 < r2) {
      int m = (l2 + r2) / 2;
      cout << "? " << n1 + (m - l2 + 1) << "\n";
      for (int i = 0; i < n1; i++) cout << u1[i] << " ";
      for (int i = l2; i <= m; i++) cout << u2[i] << " ";
      cout << "\n";
      cout.flush();
      cin >> t;
      ask++;
      if (ask == 19999) {
        cout << "here6\n";
        cout.flush();
        return 0;
      }
      if (m > l2) {
        cout << "? " << m - l2 + 1 << "\n";
        for (int i = l2; i <= m; i++) cout << u2[i] << " ";
        cout << "\n";
        cout.flush();
        cin >> t2;
        ask++;
        if (ask == 19999) {
          cout << "here6\n";
          cout.flush();
          return 0;
        }
      } else
        t2 = 0;
      t0 = t - t1 - t2;
      if (t0)
        r2 = m;
      else
        l2 = m + 1;
    }
    int y = u2[l2];
    int l1 = 0, r1 = n1 - 1;
    while (l1 < r1) {
      int m = (l1 + r1) / 2;
      cout << "? " << (m - l1 + 2) << "\n";
      for (int i = l1; i <= m; i++) cout << u1[i] << " ";
      cout << y << "\n";
      cout.flush();
      cin >> t;
      ask++;
      if (ask == 19999) {
        cout << "here6\n";
        cout.flush();
        return 0;
      }
      if (m > l1) {
        cout << "? " << (m - l1 + 1) << "\n";
        for (int i = l1; i <= m; i++) cout << u1[i] << " ";
        cout << "\n";
        cout.flush();
        cin >> t1;
        ask++;
        if (ask == 19999) {
          cout << "here6\n";
          cout.flush();
          return 0;
        }
      } else
        t1 = 0;
      t0 = t - t1;
      if (t0)
        r1 = m;
      else
        l1 = m + 1;
    }
    int x = u1[l1];
    e[x].push_back(y);
    e[y].push_back(x);
    u1[n1++] = y;
    f[y] = 1 - f[u1[l1]];
    for (int i = l2; i < n2 - 1; i++) u2[i] = u2[i + 1];
    n2--;
  }
  for (int i = 0; i < n1; i++) {
    if (f[u1[i]])
      v2.push_back(u1[i]);
    else
      v1.push_back(u1[i]);
  }
  cout << "? " << v1.size() << "\n";
  for (int x : v1) cout << x << " ";
  cout << "\n";
  cout.flush();
  ask++;
  if (ask == 19999) {
    cout << "here6\n";
    cout.flush();
    return 0;
  }
  cin >> t1;
  if (t1) {
    int n1 = v1.size(), cur = 0;
    while (cur < n1) {
      cout << "? " << n1 - cur - 1 << "\n";
      for (int i = cur + 1; i < n1; i++) cout << v1[i] << " ";
      cout << "\n";
      cout.flush();
      ask++;
      if (ask == 19999) {
        cout << "here7\n";
        cout.flush();
        return 0;
      }
      cin >> t;
      if (t == t1)
        cur++;
      else
        break;
    }
    int x = v1[cur];
    int l1 = cur + 1, r1 = n1 - 1;
    while (l1 < r1) {
      int m = (l1 + r1) / 2;
      cout << "? " << (m - l1 + 2) << "\n";
      for (int i = l1; i <= m; i++) cout << v1[i] << " ";
      cout << x << "\n";
      cout.flush();
      ask++;
      if (ask == 19999) {
        cout << "here8\n";
        cout.flush();
        return 0;
      }
      cin >> t;
      if (m > l1) {
        cout << "? " << (m - l1 + 1) << "\n";
        for (int i = l1; i <= m; i++) cout << v1[i] << " ";
        cout << "\n";
        cout.flush();
        ask++;
        if (ask == 19999) {
          cout << "here9\n";
          cout.flush();
          return 0;
        }
        cin >> t1;
      } else
        t1 = 0;
      t0 = t - t1;
      if (t0)
        r1 = m;
      else
        l1 = m + 1;
    }
    int y = v1[l1];
    dfs(x, y, 0);
    return 0;
  }
  cout << "? " << v2.size() << "\n";
  for (int x : v2) cout << x << " ";
  cout << "\n";
  cout.flush();
  ask++;
  if (ask == 19999) {
    cout << "here10\n";
    cout.flush();
    return 0;
  }
  cin >> t2;
  if (t2) {
    int n2 = v2.size(), cur = 0;
    while (cur < n2) {
      cout << "? " << n2 - cur - 1 << "\n";
      for (int i = cur + 1; i < n2; i++) cout << v2[i] << " ";
      cout << "\n";
      cout.flush();
      ask++;
      if (ask == 19999) {
        cout << "here11\n";
        cout.flush();
        return 0;
      }
      cin >> t;
      if (t == t2)
        cur++;
      else
        break;
    }
    int x = v2[cur];
    int l1 = cur + 1, r1 = n2 - 1;
    while (l1 < r1) {
      int m = (l1 + r1) / 2;
      cout << "? " << (m - l1 + 2) << "\n";
      for (int i = l1; i <= m; i++) cout << v2[i] << " ";
      cout << x << "\n";
      cout.flush();
      ask++;
      if (ask == 19999) {
        cout << "here12\n";
        cout.flush();
        return 0;
      }
      cin >> t;
      if (m > l1) {
        cout << "? " << (m - l1 + 1) << "\n";
        for (int i = l1; i <= m; i++) cout << v2[i] << " ";
        cout << "\n";
        cout.flush();
        ask++;
        if (ask == 19999) {
          cout << "here13\n";
          cout.flush();
          return 0;
        }
        cin >> t1;
      } else
        t1 = 0;
      t0 = t - t1;
      if (t0)
        r1 = m;
      else
        l1 = m + 1;
    }
    int y = v2[l1];
    dfs(x, y, 0);
    return 0;
  }
  cout << "Y " << v1.size() << "\n";
  for (int x : v1) cout << x << " ";
  cout << "\n";
  cout.flush();
}
