you give undirected graph consist n vertex m edge initially single integer write vertex vertex p_i write all p_i distinct integer 1 nyou process q query type 1 v vertex reachable vertex v edge graph include vertex v find vertex u large number p_u write print p_u replace p_u 0 2 delete ith edge graph Note query type possible vertex reachable v 0 write in case u explicitly define selection u affect choose vertex reachable v print value 0