Adam has received yet another box of Matryoshka dolls from Matryona. This time the dolls come in all shapes and sizes. Each doll i is described by three numbers: its width wi, length li, and height hi.
Doll i can be placed inside doll j if and only if wi<wj, li<lj, and hi<hj all hold. In other words, every one of the three dimensions must be strictly smaller, and a doll may not be rotated when it is nested. Moreover, each doll can hold at most one other doll directly inside it.
Nest the dolls inside one another so that the number of outermost dolls is as small as possible, and report that minimum number.
The input consists of several test cases. Each test case starts with a line containing a single integer N, the number of dolls (1≤N≤500). Each of the next N lines contains three space-separated integers wi, li, and hi (1≤wi,li,hi≤10,000), the dimensions of the i-th doll.
The input ends with a line containing N=0, which must not be processed.
For each test case, print on its own line the minimum possible number of outermost dolls after nesting the given dolls optimally.