let t tree n vertex consider graph G_0 initially equal t you give sequence q update ith update give pair distinct integer u_i v_i for 1 q define graph g_i follow if G_i1 contain edge u_i v_i remove edge form g_i otherwise add edge G_i1 form g_i Formally g_i G_i1 triangle u_i v_i triangle denote set symmetric difference furthermore guarantee t subgraph g_i in word update remove edge TConsider connected graph H run depthfirst search one tree edge ie edge lead visit vertex time traversal form span tree graph h this span tree generally fix particular graph depend start vertex order neighbor vertex traverse we vertex w good order neighbor vertex way depthfirst search start w produce t span tree for 1 q find report number good vertex