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