Beautiful vertices(why no testcase is passing )