Under construction

Still being built. Things may change

Friend Palindrome

Interview

Time limit2sMemory limit512 MB

Summary
Given a friendship graph on up to 20 students, find the largest number of students that can form a palindrome-like line where every student except the possible middle one is paired with a friend.
Level

Medium6 of 10

Topics
Dynamic programming, Bit manipulation, Graph, Brute force
Solved
No attempts yet

Problem

Jaehong is an elementary school student. At this spring's school show he takes the conductor's part and his classmates dance. The dance goes like this. The friends on stage stand in a single line and each one freestyles, then, taking the middle of the line as the reference point, the friend on the left and the friend on the right join both hands and dance together. If five friends stand in a line, the first and the fifth dance together, and the second and the fourth dance together. The third friend has nobody left to dance with, so that friend does a robot dance alone.

Every classmate wants to dance only with a close friend. Jaehong wants a big show, so he puts as many friends on stage as he can. Given the friendships, find the largest number of friends he can send onto the stage and tell Jaehong. Friends are identified by roll number, numbered from 1 to NN. Each friend has exactly one roll number.

Even if AA and BB are close friends and BB and CC are close friends, AA and CC are not necessarily close friends. Apart from the friend doing the robot dance, every friend on stage must be paired with a close friend. Any classmate can do the robot dance.

Input

The first line contains the number of classmates NN and the number of friendships MM (2≤N≤202 \le N \le 20, 0≤M≤min⁡((N2−N)/2, 50)0 \le M \le \min((N^2 - N)/2,\ 50)). Jaehong is not counted in NN. Each of the next MM lines contains one friendship as two roll numbers uu and vv. uu and vv are different, and if uu and vv are close friends then vv and uu are close friends too.

The same friendship is never given more than once. If 1 2 has already been given, neither 1 2 nor 2 1 appears again.

Output

Print the largest number of friends that can stand on the stage.

Examples3

  1. Example 1

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

    Input
    20 0
    
    Expected output
    1
    
  3. Example 3

    Input
    6 5
    1 2
    2 3
    3 4
    4 5
    5 6
    
    Expected output
    6