you give tree consist n vertex number 1 n initially vertex white you process q query different type 1 x change color vertex x black it guarantee query type 2 x vertex x find minimum index y vertex index y belong simple path x black vertex simple path visit vertex for query type 2 print answer itNote query give modified way