fn main() { let mut xx = String::new(); std::io::Read::read_to_string(&mut std::io::stdin(), &mut xx).ok(); let xx: Vec = xx.split_whitespace().flat_map(str::parse).collect(); let n = xx[0]; let mut aa: Vec = xx.clone().into_iter().skip(2).take(n).collect(); let qq: Vec = xx.into_iter().skip(n + 2).collect(); for q in qq.chunks(3) { if let &[t, l, r] = q { match t { 1 => aa.swap(l - 1, r - 1), 2 => println!("{}", ((l - 1)..r).min_by_key(|&i| aa[i]).unwrap() + 1), _ => unreachable!(), } } } }