题目描述
Problem Description


Input Format


Output Format
Output a single line with a number \( t \), representing the length of the longest upgrade sequence.
Sample Input and Output
Input Sample #1
4
1 1
0
0 0
2 1
0
1 1
0 0
3 1
0
1 1
2 2
0 0
4 1
0
1 1
2 2
3 3
0 0
Output Sample #1
3
Input Sample #2
3
1 1
0
0 0
3 1
0
0 1
2 0
1 2
9 1
0
0 1
2 3
4 5
6 7
8 0
1 2
3 4
5 6
7 8
Output Sample #2
3
Notes/Hints

输入格式
见题面 Input 部分
输出格式
见题面 Output 部分
样例输入
4
1 1
0
0 0
2 1
0
1 1
0 0
3 1
0
1 1
2 2
0 0
4 1
0
1 1
2 2
3 3
0 0
样例输出
3