#[allow(unused_imports)] use std::cmp::*; #[allow(unused_imports)] use std::collections::*; use std::io::Read; fn get_word() -> String { let stdin = std::io::stdin(); let mut stdin=stdin.lock(); let mut u8b: [u8; 1] = [0]; loop { let mut buf: Vec = Vec::with_capacity(16); loop { let res = stdin.read(&mut u8b); if res.unwrap_or(0) == 0 || u8b[0] <= b' ' { break; } else { buf.push(u8b[0]); } } if buf.len() >= 1 { let ret = String::from_utf8(buf).unwrap(); return ret; } } } fn get() -> T { get_word().parse().ok().unwrap() } fn ask(v: &[usize]) -> bool { print!("?"); for &v in v { print!(" {}", v + 1); } println!(); let x = get_word(); x == "Yes" } fn main() { let n: usize = get(); let mut f = vec![0; n]; for i in 0..n { let mut x = 0; loop { if !ask(&vec![i; x + 1]) { break; } x += 1; } f[i] = x; } // eprintln!("f = {:?}", f); let mut init = vec![0; f[0]]; for i in 1..n { let mut last = 0; for _ in 0..f[i] { let mut pass = last; let mut fail = init.len() + 1; while fail - pass > 1 { let mid = (fail + pass) / 2; let mut tmp = init[..mid].to_vec(); tmp.push(i); if ask(&tmp) { pass = mid; } else { fail = mid; } } init.insert(pass, i); last = pass + 1; } } print!("!"); for v in init { print!(" {}", v + 1); } println!(); }