assume k onedimensional segment s_1 s_2 dot s_k segment denote integer endpoint then build follow graph segment the graph consist k vertex edge ith jth vertexes neq j segment s_i s_j intersect exist point belong themfor example s_1 1 6 s_2 8 20 s_3 4 10 s_4 2 13 s_5 17 18 result graph follow a tree size m good possible choose m onedimensional segment graph build segment coincide treeyou give tree find good subtree maximum possible size Recall subtree connect subgraph treenote answer q independent query