you give segment l_1 r_1 l_2 r_2 xaxis it guarantee l_1 r_1 l_2 r_2 segment intersect overlap coincide the example segment xaxis your problem find integer b l_1 le le r_1 l_2 le b le r_2 ne b in word choose distinct integer point way point belong segment l_1 r_1 second belong segment l_2 r_2it guarantee answer exist if multiple answer print themyou answer q independent query