Bear and Friendship Condition

CodeForces - 771A