/*
TASK:TRI
LANG:C++
*/
#include<iostream>
using namespace std;
int main()
{
    int n,m;
    cin>>n>>m;
    int a[m][2],array[n][3],br=-1,br1=0;
    for(int i=0; i<m; i++)for(int j=0; j<=1; j++)cin>>a[i][j];
    int t1,t2,t3;
    bool b1,b2;
    // begin
    for(int p1=0; p1<(m-2); p1++)
    {
        t1=a[p1][0];
        t2=a[p1][1];
        b1=true;
        for(int p2=p1+1; p2<(m-1); p2++)
        {
            if(a[p2][0]==t1 || a[p2][0]==t2){ t3=a[p2][1]; b1=true; }
            if(a[p2][1]==t1 || a[p2][1]==t2){ t3=a[p2][0]; b1=true; }
            b2=true;
            for(int p3=p2+1; p3<m; p3++)
            {
                if(a[p3][0]==t1 || a[p3][1]==t1
                || a[p3][0]==t2 || a[p3][1]==t2
                || a[p3][0]==t3 || a[p3][1]==t3)
                { b2=false; break; }
            }
            if(b2==false)continue;
            else
            {
                br++;
                array[br][0]=t1;
                array[br][1]=t2;
                array[br][2]=t3;
            }
        }
        if(b1==false)continue;
    }
    // end
    int s=0,r,time;
    if(br==-1)r=0;
    else
    {
        for(int i2=0; i2<=br; i2++)
        {
            time=array[i2][0]+array[i2][1]+array[i2][2];
            if(time>s)s=time;
        }
        r=s;
    }
    cout<<r<<endl;
    return 0;
}
