Ticket 3018

Logs
Input
2
1 2
4 7 
1 3
10 11 8 

Expected Output
5
9

Update Logs

Note: You can also use F5 to update the logs. This would also retain cursor position while scrolling.