This page is still under construction.

Parts of this page are still being built. What you see may change.

K-Graph Oddity

Interview

Time limit1sMemory limit128 MB

Summary
Compute the maximum vertex degree in a graph and output the smallest odd integer greater than or equal to it.
Level

Easy2 of 10

Topics
Graph, Implementation, Math
Solved
No attempts yet

Problem

You are given a connected undirected graph with an odd number of vertices. The degree of a vertex is the number of edges incident to it.

It is a well-known fact that such a graph can always be properly colored — that is, every vertex can be assigned a color so that no two adjacent vertices share the same color — using at most kk colors, where kk is the smallest odd integer that is greater than or equal to the maximum degree of the graph.

Given the graph, determine this value kk.

Input

The first line contains two integers nn and mm: the number of vertices nn (3≤n≤99993 \le n \le 9999, nn is odd) and the number of edges mm (2≤m≤100 0002 \le m \le 100\,000).

Each of the next mm lines contains two integers aia_i and bib_i (1≤ai,bi≤n1 \le a_i, b_i \le n, ai≠bia_i \ne b_i) describing an edge between vertices aia_i and bib_i. Each edge is listed at most once. The graph is connected, so there is a path between every pair of vertices.

Output

Output a single integer kk — the smallest odd integer such that the degree of every vertex does not exceed kk (equivalently, the smallest odd integer that is greater than or equal to the maximum vertex degree).

Examples4

  1. Example 1

    Input
    3 2
    1 3
    3 2
    
    Expected output
    3
    
  2. Example 2

    Input
    7 8
    1 4
    4 2
    2 6
    6 3
    3 7
    4 5
    5 6
    5 2
    
    Expected output
    3
    
  3. Example 3

    Input
    5 4
    1 2
    1 3
    1 4
    1 5
    
    Expected output
    5
    
  4. Example 4

    Input
    3 3
    1 2
    2 3
    1 3
    
    Expected output
    3