fn main() { let mut t = String::new(); std::io::stdin().read_line(&mut t).ok(); let t: usize = t.trim().parse().unwrap(); for _ in 0..t { let mut hw = String::new(); std::io::stdin().read_line(&mut hw).ok(); let hw: Vec = hw.trim().split_whitespace().map(|s| s.parse().unwrap()).collect(); let h = hw[0]; let w = hw[1]; let result = (0..=h).map(|i| { let ret = if i % 3 == 0 { (0..=w).map(|j| if j % 3 == 0 { "0" } else { "1" }).collect::>().join("") } else { (0..=w).map(|j| if j % 3 == 0 { "1" } else { "2" }).collect::>().join("") }; ret.chars().collect::>() }) .collect::>(); let hstart = if h % 3 == 2 { 1 } else { 0 }; let wstart = if w % 3 == 2 { 1 } else { 0 }; for i in 0..h { for j in 0..w { print!("{}", result[i+hstart][j+wstart]); } println!(); } } }