#include <bits/stdc++.h>
using ul = std::uint32_t;
using li = std::int32_t;
using ull = std::uint64_t;
using ll = std::int64_t;
using vul = std::vector<ul>;
using vvul = std::vector<vul>;
using vb = std::vector<bool>;
using vvb = std::vector<vb>;
using vvvb = std::vector<vvb>;
using vull = std::vector<ull>;
using vli = std::vector<li>;
using vll = std::vector<ll>;
using pulul = std::pair<ul, ul>;
using vpulul = std::vector<pulul>;
ul n;
std::mt19937 rands;
vul p(601, 0);
vvul sons(601);
const ul sz = 1 << 10;
vul already(sz << 1, 0);
vul remain(sz << 1, 0);
void insert(vul& set, ul v) {
  for (set[v |= sz] = 1, v >>= 1; v; v >>= 1) {
    set[v] = set[v << 1 | 1] + set[v << 1];
  }
}
void erase(vul& set, ul v) {
  for (set[v |= sz] = 0, v >>= 1; v; v >>= 1) {
    set[v] = set[v << 1 | 1] + set[v << 1];
  }
}
ul find(const vul& set, ul rank) {
  ul v = 1;
  while (v < sz) {
    if (rank < set[v << 1]) {
      v <<= 1;
    } else {
      rank -= set[v << 1];
      v = v << 1 | 1;
    }
  }
  return v & ~sz;
}
vvul set(2, vul(sz << 1, 0));
vul part(601, 0);
vul out0, out1;
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  rands.seed(std::time(0));
  std::cin >> n;
  if (n == 1) {
    std::cout << "Y 1" << std::endl;
    std::cout << "1" << std::endl;
    return 0;
  }
  for (ul i = 1; i <= n; ++i) {
    insert(remain, i);
  }
  ul root = rands() % n + 1;
  insert(already, root);
  erase(remain, root);
  insert(set[0], root);
  while (already[1] != n) {
    ul l = 0, r = already[1];
    std::cout << "? " << remain[1] << std::endl;
    for (ul i = 0; i != remain[1]; ++i) {
      if (i) {
        std::cout << ' ';
      }
      std::cout << find(remain, i);
    }
    std::cout << std::endl;
    ul temp0;
    std::cin >> temp0;
    while (l + 1 != r) {
      ul mid = l + r >> 1;
      std::cout << "? " << mid - l << std::endl;
      ;
      for (ul i = l; i != mid; ++i) {
        if (i != l) {
          std::cout << ' ';
        }
        std::cout << find(already, i);
      }
      std::cout << std::endl;
      ul temp1;
      std::cin >> temp1;
      std::cout << "? " << mid - l + remain[1] << std::endl;
      for (ul i = l; i != mid; ++i) {
        if (i != l) {
          std::cout << ' ';
        }
        std::cout << find(already, i);
      }
      for (ul i = 0; i != remain[1]; ++i) {
        std::cout << ' ' << find(remain, i);
      }
      std::cout << std::endl;
      ul temp2;
      std::cin >> temp2;
      if (temp0 + temp1 != temp2) {
        r = mid;
      } else {
        l = mid;
      }
    }
    ul father = find(already, l);
    l = 0, r = remain[1];
    while (l + 1 != r) {
      ul mid = l + r >> 1;
      std::cout << "? " << mid - l << std::endl;
      for (ul i = l; i != mid; ++i) {
        if (i != l) {
          std::cout << ' ';
        }
        std::cout << find(remain, i);
      }
      std::cout << std::endl;
      ul temp1;
      std::cin >> temp1;
      std::cout << "? " << mid - l + 1 << std::endl;
      std::cout << father;
      for (ul i = l; i != mid; ++i) {
        std::cout << ' ' << find(remain, i);
      }
      std::cout << std::endl;
      ul temp2;
      std::cin >> temp2;
      if (temp1 != temp2) {
        r = mid;
      } else {
        l = mid;
      }
    }
    ul son = find(remain, l);
    sons[father].push_back(son);
    p[son] = father;
    part[son] = part[father] + 1;
    insert(set[part[son] & 1], son);
    insert(already, son);
    erase(remain, son);
  }
  std::cout << "? " << set[0][1] << std::endl;
  for (ul i = 0; i != set[0][1]; ++i) {
    if (i) {
      std::cout << ' ';
    }
    std::cout << find(set[0], i);
  }
  std::cout << std::endl;
  ul temp;
  std::cin >> temp;
  if (temp) {
    auto s = std::move(set[0]);
    for (ul a = 0;; ++a) {
      std::cout << "? " << s[1] - a - 1 << std::endl;
      for (ul i = a + 1; i != s[1]; ++i) {
        if (i != a + 1) {
          std::cout << ' ';
        }
        std::cout << find(s, i);
      }
      std::cout << std::endl;
      ul temp1;
      std::cin >> temp1;
      std::cout << "? " << s[1] - a << std::endl;
      for (ul i = a; i != s[1]; ++i) {
        if (i != a) {
          std::cout << ' ';
        }
        std::cout << find(s, i);
      }
      std::cout << std::endl;
      ul temp2;
      std::cin >> temp2;
      if (temp1 != temp2) {
        for (ul b = a + 1;; ++b) {
          std::cout << "? 2" << std::endl;
          std::cout << find(s, a) << ' ' << find(s, b) << std::endl;
          std::cin >> temp1;
          if (temp1) {
            a = find(s, a);
            b = find(s, b);
            if (part[a] < part[b]) {
              std::swap(a, b);
            }
            vul out1, out0;
            while (part[a] > part[b]) {
              out0.push_back(a);
              a = p[a];
            }
            while (a != b) {
              out0.push_back(a);
              out1.push_back(b);
              a = p[a];
              b = p[b];
            }
            std::cout << "N " << out0.size() + out1.size() + 1 << std::endl;
            std::cout << a;
            for (ul i = out1.size() - 1; ~i; --i) {
              std::cout << ' ' << out1[i];
            }
            for (ul i = 0; i != out0.size(); ++i) {
              std::cout << ' ' << out0[i];
            }
            std::cout << std::endl;
            return 0;
          }
        }
      }
    }
  }
  std::cout << "? " << set[1][1] << std::endl;
  for (ul i = 0; i != set[1][1]; ++i) {
    if (i) {
      std::cout << ' ';
    }
    std::cout << find(set[1], i);
  }
  std::cout << std::endl;
  temp;
  std::cin >> temp;
  if (temp) {
    auto s = std::move(set[1]);
    for (ul a = 0;; ++a) {
      std::cout << "? " << s[1] - a - 1 << std::endl;
      for (ul i = a + 1; i != s[1]; ++i) {
        if (i != a + 1) {
          std::cout << ' ';
        }
        std::cout << find(s, i);
      }
      std::cout << std::endl;
      ul temp1;
      std::cin >> temp1;
      std::cout << "? " << s[1] - a << std::endl;
      for (ul i = a; i != s[1]; ++i) {
        if (i != a) {
          std::cout << ' ';
        }
        std::cout << find(s, i);
      }
      std::cout << std::endl;
      ul temp2;
      std::cin >> temp2;
      if (temp1 != temp2) {
        for (ul b = a + 1;; ++b) {
          std::cout << "? 2" << std::endl;
          std::cout << find(s, a) << ' ' << find(s, b) << std::endl;
          std::cin >> temp1;
          if (temp1) {
            a = find(s, a);
            b = find(s, b);
            if (part[a] < part[b]) {
              std::swap(a, b);
            }
            vul out1, out0;
            while (part[a] > part[b]) {
              out0.push_back(a);
              a = p[a];
            }
            while (a != b) {
              out0.push_back(a);
              out1.push_back(b);
              a = p[a];
              b = p[b];
            }
            std::cout << "N " << out0.size() + out1.size() + 1 << std::endl;
            std::cout << a;
            for (ul i = out1.size() - 1; ~i; --i) {
              std::cout << ' ' << out1[i];
            }
            for (ul i = 0; i != out0.size(); ++i) {
              std::cout << ' ' << out0[i];
            }
            std::cout << std::endl;
            return 0;
          }
        }
      }
    }
  }
  std::cout << "Y " << set[0][1] << std::endl;
  for (ul i = 0; i != set[0][1]; ++i) {
    if (i) {
      std::cout << ' ';
    }
    std::cout << find(set[0], i);
  }
  std::cout << std::endl;
  return 0;
}
