use std::io::Read; fn main() { let mut s = String::new(); std::io::stdin().read_to_string(&mut s).ok(); let mut n: Vec = s.split_whitespace().skip(1).flat_map(str::parse).collect(); let l = n.len() - 1; for i in 1..l * 2 - 1 { for p in 0.max(i.saturating_sub(l))..=i / 2 { if n[p] > n[i - p] { n.swap(p, i - p); } } } println!( "{}", n.iter() .map(|x| x.to_string()) .collect::>() .join(" ") ); }