func solve() { guard let N = Int(readLine() ?? "") else { return } var size: [(Int, Int)] = [] for _ in 0..