void main(){ import std.stdio, std.string, std.conv, std.algorithm; import std.typecons; int n; rd(n); alias T=Tuple!(int, "x", int, "y", int, "z"); auto bs=new T[](n); foreach(i; 0..n){ auto xyz=readln.split.to!(int[]); sort(xyz); bs[i]=T(xyz[0], xyz[1], xyz[2]); } sort(bs); auto rec=new int[](n); fill(rec, 1); foreach(i; 1..n)foreach(j; 0..i){ bool ok=bs[i].x>bs[j].x; ok&=bs[i].y>bs[j].y; ok&=bs[i].z>bs[j].z; if(ok) chmax(rec[j], rec[i]+1); } writeln(reduce!(max)(rec)); } void chmax(T)(ref T x, T y){ if(x