Statement
There is a grid with two rows and columns.
You are given rectangular regions. The -th rectangle is described by four integers and covers every cell whose row is between and and whose column is between and , inclusive.
Choose some of the rectangles so that no two chosen rectangles cover the same grid cell.
Find the maximum possible number of chosen rectangles.
Input
The input is given from Standard Input in the following format:
Each case is given in the following format:
Output
For each test case, print the maximum number of rectangles that can be selected.
Constraints
- .
- .
- .
- ().
- ().
- The sum of over all test cases does not exceed .
Subtasks
Samples
Rectangles cover no common cell, so four rectangles can be selected. Rectangles and both cover cell , so it is impossible to select all five rectangles.