/* -*- coding: utf-8 -*- * * 1959.cc: No.1959 Prefix MinMax - yukicoder */ #include #include #include using namespace std; /* constant */ const int MAX_N = 1000; /* typedef */ /* global variables */ int as[MAX_N], bs[MAX_N], ps[MAX_N]; /* subroutines */ void query(int n, int as[], int bs[]) { putchar('?'); for (int i = 0; i < n - 1; i++) printf(" %d", as[i]); putchar('\n'); fflush(stdout); for (int i = 0; i < n; i++) { scanf("%d", bs + i); if (bs[i] < 1 || bs[i] > n) exit(0); } } /* main */ int main() { int tn; scanf("%d", &tn); while (tn--) { int n; scanf("%d", &n); fill(ps, ps + n, 0); for (int i = 0; i < n - 1; i++) as[i] = (i & 1); query(n, as, bs); for (int i = 0, pb = -1; i < n; i++) if (pb != bs[i]) pb = ps[i] = bs[i]; for (int i = 0; i < n - 1; i++) as[i] = (i & 1) ^ 1; query(n, as, bs); for (int i = 0, pb = -1; i < n; i++) if (pb != bs[i]) pb = ps[i] = bs[i]; putchar('!'); for (int i = 0; i < n; i++) printf(" %d", ps[i]); putchar('\n'); fflush(stdout); } //sleep(1); return 0; }