#[allow(unused_imports)] use proconio::{ input, marker::{Bytes, Chars, Usize1}, }; fn main() { input! { p: isize, q: isize, x: isize, a: isize, b: isize, y: isize, } let c = y - x; let d = (a - 1 + c) % p + 1; let e = (b - 1 + d) % q + 1; println!("{} {}", d, e); }