#include <bits/stdc++.h>
using namespace std;
void get(int &v) {
  char c;
  while ((c = getchar()) != EOF && isdigit(c) == 0)
    ;
  v = c - '0';
  while ((c = getchar()) != EOF && isdigit(c))
    v = (v << 1) + (v << 3) + c - '0';
  return;
}
int get() {
  int v;
  char c;
  while ((c = getchar()) != EOF && isdigit(c) == 0)
    ;
  v = c - '0';
  while ((c = getchar()) != EOF && isdigit(c))
    v = (v << 1) + (v << 3) + c - '0';
  return v;
}
int num[1080];
int tmp[20], sz[20];
bool same[20];
queue<int> q;
int main() {
  int n, x, y, i, j, t, p1 = 0, p2 = 0, cnt, tt;
  get(n);
  get(x);
  get(y);
  for (i = 0; i < 10; i++) {
    for (j = 1; j <= n; j++)
      if (j & (1 << i)) q.push(j);
    if (q.empty()) continue;
    printf("? %d", sz[i] = q.size());
    while (q.size()) printf(" %d", q.front()), q.pop();
    putchar('\n');
    fflush(stdout);
    get(tmp[i]);
  }
  cnt = i;
  for (i = 0; i < cnt; i++) {
    if (sz[i] & 1)
      t = x;
    else
      t = 0;
    same[i] = (t == tmp[i]);
  }
  for (i = 0; i < cnt; i++) {
    if (sz[i] & 1)
      t = x;
    else
      t = 0;
    if (t != tmp[i]) break;
  }
  t = i;
  for (i = 0; i < 10; i++)
    if (j != t) {
      for (j = 1; j <= n; j++)
        if ((j & (1 << i)) && (j & (1 << t)) == 0) q.push(j);
      if (q.empty()) continue;
      printf("? %d", sz[cnt + i] = q.size());
      while (q.size()) printf(" %d", q.front()), q.pop();
      putchar('\n');
      fflush(stdout);
      get(tmp[cnt + i]);
    }
  for (i = 0; i < 10; i++)
    if (j != t) {
      if (sz[cnt + i] & 1)
        tt = x;
      else
        tt = 0;
      if (tt == tmp[cnt + i]) {
        if (same[i]) {
          p1 |= 0;
          p2 |= 0;
        } else {
          p1 |= 0;
          p2 |= (1 << i);
        }
      } else {
        if (same[i]) {
          p1 |= (1 << i);
          p2 |= (1 << i);
        } else {
          p1 |= (1 << i);
          p2 |= 0;
        }
      }
    } else {
      p1 |= (1 << j);
      p2 |= 0;
    }
  printf("! %d %d", min(p1, p2), max(p1, p2));
  return 0;
}
