CodeLab Academy 📞 9936 6696
← List Python · Level 10: Algorithms Code · 100 points ← #917 #919 →

#918. Sort pairs

You get n lines with pairs `a b`. Sort them by b in increasing order; if b is equal, by a in increasing order. Print them. ### Input n, then n lines. ### Output n lines.

Examples

Input
3
8 5
2 5
2 0
Output
2 0
2 5
8 5
Input
6
1 0
3 0
4 4
1 4
5 4
2 1
Output
1 0
3 0
2 1
1 4
4 4
5 4

💡 You can solve it with Python, JavaScript or blocks. Read the input line by line with input(). Don't print a question (like input("Number: ")). Print exactly what the output asks for, nothing more.

🔒 You can solve the first 3 problems without an account. Sign up for free to solve this one!