mod util { pub trait Join { fn join(self, sep: &str) -> String; } impl Join for I where I: Iterator, T: std::fmt::Display, { fn join(self, sep: &str) -> String { let mut s = String::new(); use std::fmt::*; for (i, v) in self.enumerate() { if i > 0 { write!(&mut s, "{}", sep).ok(); } write!(&mut s, "{}", v).ok(); } s } } } fn read() -> Vec { let mut s = String::new(); loop { std::io::stdin().read_line(&mut s).unwrap(); let res = s .trim() .split_whitespace() .flat_map(|s| s.parse()) .collect::>(); if res.len() > 0 { return res; } } } fn run() { use util::*; let n = read()[0]; println!("? {}", [0, 1].iter().cycle().take(n - 1).join(" ")); let p = read(); let mut ask = vec![0; n - 1]; for i in 0..(n - 1) { if p[i] == p[i + 1] { ask[i] = (i % 2) ^ 1; } } println!("? {}", ask.iter().join(" ")); let q = read(); let mut ans = p.clone(); for i in 0..(n - 1) { if p[i] == p[i + 1] { ans[i + 1] = q[i + 1]; } } println!("! {}", ans.iter().join(" ")); } fn main() { let t = read()[0]; for _ in 0..t { run(); } }