Anadi has a set of dominoes. Every domino has two parts, and each part contains some dots. For every $a$ and $b$ such that $1 \leq a \leq b \leq 6$, there is exactly one domino with $a$ dots on one half and $b$ dots on the other half. The set contains exactly $21$ dominoes. Here is an exact illustration of his set:

 [Image] 

Also, Anadi has an undirected graph without self-loops and multiple edges. He wants to choose some dominoes and place them on the edges of this graph. He can use at most one domino of each type. Each edge can fit at most one domino. It's not necessary to place a domino on each edge of the graph.

When placing a domino on an edge, he also chooses its direction. In other words, one half of any placed domino must be directed toward one of the endpoints of the edge and the other half must be directed toward the other endpoint. There's a catch: if there are multiple halves of dominoes directed toward the same vertex, each of these halves must contain the same number of dots.

How many dominoes at most can Anadi place on the edges of his graph?


-----Input-----

The first line contains two integers $n$ and $m$ ($1 \leq n \leq 7$, $0 \leq m \leq \frac{n\cdot(n-1)}{2}$) — the number of vertices and the number of edges in the graph.

The next $m$ lines contain two integers each. Integers in the $i$-th line are $a_i$ and $b_i$ ($1 \leq a, b \leq n$, $a \neq b$) and denote that there is an edge which connects vertices $a_i$ and $b_i$.

The graph might be disconnected. It's however guaranteed that the graph doesn't contain any self-loops, and that there is at most one edge between any pair of vertices.


-----Output-----

Output one integer which denotes the maximum number of dominoes which Anadi can place on the edges of the graph.


-----Examples-----
Input
4 4
1 2
2 3
3 4
4 1

Output
4

Input
7 0

Output
0

Input
3 1
1 3

Output
1

Input
7 21
1 2
1 3
1 4
1 5
1 6
1 7
2 3
2 4
2 5
2 6
2 7
3 4
3 5
3 6
3 7
4 5
4 6
4 7
5 6
5 7
6 7

Output
16



-----Note-----

Here is an illustration of Anadi's graph from the first sample test:

 [Image] 

And here is one of the ways to place a domino on each of its edges:

 [Image] 

Note that each vertex is faced by the halves of dominoes with the same number of dots. For instance, all halves directed toward vertex $1$ have three dots.

Difficulty: interview

Starter code:

Solutions:
n, m = map(int, input().split())

d = [0 for i in range(7)]
g = [[] for i in range(7)]

for i in range(m):
	x, y = map(int, input().split())
	x -= 1
	y -= 1
	d[x] += 1
	d[y] += 1
	
	g[x].append(y)
	g[y].append(x)
	
mn = min(d)
for i in range(7):
	for j in range(i):
		cnt = 0
		for k in range(7):
			if((k in g[i]) and (k in g[j])):
				cnt += 1
		mn = min(mn, cnt)
m -= mn
print(m) 


from collections import defaultdict
n, m = list(map(int, input().split()))
graph = defaultdict(set)
for _ in range(m):
    a, b = list(map(int, input().split()))
    graph[a].add(b)
    graph[b].add(a)
 
ans = 100
for i in range(1, 7):
    for j in range(i + 1, 8):
        g = graph[i] & graph[j]
        ans = min(ans, len(g))
print(m - ans)


n, m = list(map(int, input().split()))
graph = [[] for _ in range(n)]
for _ in range(m):
    u, v = list(map(int, input().split()))
    u -= 1
    v -= 1
    graph[u].append(v)
    graph[v].append(u)
maxcnt = 0
for node1 in range(n):
    for node2 in range(node1 + 1, n):
        used = [[False] * n for _ in range(n)]
        col = list(range(0, node2)) + [node1] + list(range(node2 + 1, n))
        cnt = 0
        for u in range(n):
            for v in graph[u]:
                if not used[col[u]][col[v]]:
                    used[col[u]][col[v]] = used[col[v]][col[u]] = True
                    cnt += 1
        maxcnt = max(cnt, maxcnt)
print(maxcnt if n > 6 else m)


n,m = [int(j) for j in input().split()]
adj = [set() for i in range(n)]
for i in range(m):
	l, r = [int(j)-1 for j in input().split()]
	adj[l].add(r)
	adj[r].add(l)
if n<7:
	print(m)
else:
	deg = 1e12
	for i in range(n):
		for j in range(i+1, n):
			l = adj[i].intersection(adj[j])
			# print(l)
			tmp = len(l)
			if tmp<deg:
				deg = tmp
		# deg = min(len(adj[i]), deg)
	# deg = ma
	# print(deg)
	print(m-deg)

n, m = list(map(int, input().split()))

a=[]
b=[]

for _ in range(m):
  aa, bb = list(map(int, input().split()))
  if (bb < aa):
    aa,bb = bb,aa
  a.append(aa)
  b.append(bb)

if (n <= 6):
  print(m)
else:
  
  maxv = 0
  for i in range(1, n + 1):
    for j in range(i + 1, n + 1):
      alle = m
      minuse = 0
      tk = []
      for k in range(len(a)):
        if (i == a[k] and j != b[k]):
          alle -= 1
          tk.append(b[k])
        elif (i != a[k] and j == b[k]):
          alle -= 1
          tk.append(a[k])
        elif (i == b[k] and j != a[k]):
          alle -= 1
          tk.append(a[k])
        elif (i != b[k] and j == a[k]):
          alle -= 1
          tk.append(b[k])
      #print(alle)
      #print('set' + str(len(set(tk))))
      #return
      alle += len(set(tk))
      maxv = max(alle, maxv)
  print(maxv)

          
      


n,m = [int(j) for j in input().split()]
adj = [set() for i in range(n)]
for i in range(m):
	l, r = [int(j)-1 for j in input().split()]
	adj[l].add(r)
	adj[r].add(l)
if n<7:
	print(m)
else:
	deg = 10**12
	for i in range(n):
		for j in range(i+1, n):
			l = adj[i].intersection(adj[j])
			tmp = len(l)
			if tmp<deg:
				deg = tmp
	print(m-deg)


n,m = [int(j) for j in input().split()]
adj = [set() for i in range(n)]
for i in range(m):
	l, r = [int(j)-1 for j in input().split()]
	adj[l].add(r)
	adj[r].add(l)
if n<7:
	print(m)
else:
	maxi = 10**12
	for i in range(n):
		for j in range(i+1, n):
			l = adj[i].intersection(adj[j])
			tmp = len(l)
			if tmp<maxi:
				maxi = tmp
	print(m-maxi)


n,m = [int(j) for j in input().split()]
adj = [set() for i in range(n)]
for i in range(m):
	l, r = [int(j)-1 for j in input().split()]
	adj[l].add(r)
	adj[r].add(l)
if n<7:
	print(m)
else:
	maxi = 10**12
	for i in range(n):
		for j in range(i+1, n):
			l = adj[i].intersection(adj[j])
			tmp = len(l)
			if tmp<maxi:
				maxi = tmp
	print(m-maxi)


import itertools
n,m = list(map(int,input().split()))
arr = []
for i in range(n):
    arr.append([])
for i in range(m):
    a,b = list(map(int,input().split()))
    a-=1
    b-=1
    arr[a].append(b)
    arr[b].append(a)
permuts = list(itertools.permutations(list(range(7))))
ans = 0
for i in range(len(permuts)):
    permut = permuts[i]
    was = []
    for i in range(6):
        was.append([False]*6)
    c = 0
    for i in range(n):
        if permut[i] != 6:
            for g in range(len(arr[i])):
                if not permut[arr[i][g]] == 6:
                    if not was[permut[i]][permut[arr[i][g]]]:
                        c+=1
                        was[permut[i]][permut[arr[i][g]]] = True
                        was[permut[arr[i][g]]][permut[i]] = True
    for w in range(n):
        if permut[w] == 6:
            ams = [0]*6
            for g in range(len(arr[w])):
                for j in range(6):
                    if not was[permut[arr[w][g]]][j]:
                        ams[j]+=1
            c+=max(ams)
            break



    ans = max(ans,c)
print(ans)