Enemy Division

Time limit1sMemory limit128 MB

Summary
Divide soldiers into the fewest groups so that each soldier shares a group with at most one enemy, where every soldier has at most 3 enemies.
Level

Hard8 of 10

Topics
Graph, Greedy, Combinatorics, Implementation
Solved
No attempts yet

Problem

It is the year 2147 and a great war rages across the world. Captain Keram's soldiers have fought side by side since the war began two years ago, and along the way some of them have become enemies of one another. Fortunately, each soldier has at most 3 enemies.

They must soon attack another country, and Keram worries that soldiers who are enemies might not cooperate during battle. He has therefore decided to split the soldiers into groups so that every soldier has at most one of his enemies in his own group. He also wants to keep things simple, so he wants to use as few groups as possible. Help Captain Keram by finding the minimum number of groups he needs.

Input

The first line contains two integers nn and mm (2≤n≤100 0002 \le n \le 100\,000, 0≤m≤3n/20 \le m \le 3n/2), where nn is the number of soldiers and mm is the number of enemy pairs.

Each of the next mm lines contains two space-separated integers aia_i and bib_i (1≤ai<bi≤n1 \le a_i < b_i \le n), meaning that soldiers aia_i and bib_i are enemies. You may assume that every soldier has at most 3 enemies.

Output

Output a single integer: the minimum number of groups kk such that the soldiers can be split into kk groups with every soldier sharing his group with at most one of his enemies.

Examples3

  1. Example 1

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

    Input
    2 0
    
    Expected output
    1
    
  3. Example 3

    Input
    2 1
    1 2
    
    Expected output
    1