문제
Farmer John and his cows are planning to leave town for a long vacation, and so FJ wants to temporarily close down his farm to save money in the meantime.
The farm consists of
FJ is interested in knowing at each point in time (initially, and after each closing) whether his farm is "fully connected" -- meaning that it is possible to travel from any open barn to any other open barn along an appropriate series of paths. Since FJ's farm is initially in somewhat in a state of disrepair, it may not even start out fully connected.
Problem credits: Yang Liu
입력
The first line of input contains
출력
The output consists of
예제
4 3
1 2
2 3
3 4
3
4
1
2
YES
NO
YES
YES