{"raw_statement":[{"iden":"problem statement","content":"You want to choose three persons from $N$ candidates to form a team.  \nEach candidate has five parameters: power, speed, technique, knowledge, and inventiveness.  \nThe power, speed, technique, knowledge, and the inventiveness of the $i$\\-th candidate are $A_i$, $B_i$, $C_i$, $D_i$, and $E_i$, respectively.  \nLet us define your team's power as the maximum of the members' powers. The team's speed, technique, knowledge, and inventiveness are defined similarly.  \nThen, let us define your team's total strength as the minimum of the team's power, speed, technique, knowledge, and inventiveness.  \nFind the maximum possible value of your team's total strength."},{"iden":"constraints","content":"*   All values in input are integers.\n*   $3 ≤ N ≤ 3000$\n*   $1 ≤ A_i, B_i, C_i, D_i, E_i ≤ 10^9$"},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$N$\n$A_1$ $B_1$ $C_1$ $D_1$ $E_1$\n$A_2$ $B_2$ $C_2$ $D_2$ $E_2$\n$\\vdots$\n$A_N$ $B_N$ $C_N$ $D_N$ $E_N$"},{"iden":"sample input 1","content":"3\n3 9 6 4 6\n6 9 3 1 1\n8 8 9 3 7"},{"iden":"sample output 1","content":"4\n\nWe have no choice but to choose all three of them.  \nThen, the team's parameters will be as follows:\n\n*   power: $\\max(3, 6, 8) = 8$;\n*   speed: $\\max(9, 9, 8) = 9$;\n*   technique: $\\max(6, 3, 9) = 9$;\n*   knowledge: $\\max(4, 1, 3) = 4$;\n*   inventiveness: $\\max(6, 1, 7) = 7$.\n\nThus, the team's total strength will be $\\min(8, 9, 9, 4, 7) = 4$."},{"iden":"sample input 2","content":"5\n6 13 6 19 11\n4 4 12 11 18\n20 7 19 2 5\n15 5 12 20 7\n8 7 6 18 5"},{"iden":"sample output 2","content":"13\n\nIf we choose the $1$\\-st, $2$\\-nd, and $3$\\-rd candidates, the team's total strength will be $\\min(20, 13, 19, 19, 18) = 13$."},{"iden":"sample input 3","content":"10\n6 7 5 18 2\n3 8 1 6 3\n7 2 8 7 7\n6 3 3 4 7\n12 8 9 15 9\n9 8 6 1 10\n12 9 7 8 2\n10 3 17 4 10\n3 1 3 19 3\n3 14 7 13 1"},{"iden":"sample output 3","content":"10"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}