CF246D Colorful Graph
Description
You've got an undirected graph, consisting of $ n $ vertices and $ m $ edges. We will consider the graph's vertices numbered with integers from 1 to $ n $ . Each vertex of the graph has a color. The color of the $ i $ -th vertex is an integer $ c_{i} $ .
Let's consider all vertices of the graph, that are painted some color $ k $ . Let's denote a set of such as $ V(k) $ . Let's denote the value of the neighbouring color diversity for color $ k $ as the cardinality of the set $ Q(k)={c_{u} : c_{u}≠k $ and there is vertex $ v $ belonging to set $ V(k) $ such that nodes $ v $ and $ u $ are connected by an edge of the graph $ } $ .
Your task is to find such color $ k $ , which makes the cardinality of set $ Q(k) $ maximum. In other words, you want to find the color that has the most diverse neighbours. Please note, that you want to find such color $ k $ , that the graph has at least one vertex with such color.
Input Format
The first line contains two space-separated integers $ n,m $ $ (1
Output Format
Print the number of the color which has the set of neighbours with the maximum cardinality. It there are multiple optimal colors, print the color with the minimum number. Please note, that you want to find such color, that the graph has at least one vertex with such color.