#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <cassert>

#define foreach(it,v) for (__typeof((v).begin()) it = (v).begin(); it != (v).end(); it++)
#define sqr(a) ((a)*(a)) 
#define MP(a,b) make_pair((a),(b))

template <class T> void Cmin(T &t,T x){if (x < t) t = x;}
template <class T> void Cmax(T &t,T x){if (x > t) t = x;}

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;
typedef pair<double, double> PDD;
typedef vector<int> VI;

const int INF = 0x3fffffff;
const LL LINF = 1LL << 60;
const double PI = acos(-1.0);
const double EPS = 1e-9;

int ans, sum, tmp;

class BCC{
public:
	const static int maxN = 5010;
	const static int maxM = 50100;
	struct graph{
		int v, next;
	}edge[maxM];
	
	int dfn[maxN], low[maxN];
	int st[maxN], top;
	int vect[maxN], tot;
	int n;
	vector<pair<int, int> > keyE;
	vector<int> keyV;
	
	void add(int u, int v){
		edge[++tot].v = v;
		edge[tot].next = vect[u];
		vect[u] = tot;
	}
	
	void init(int _n){
		n = _n;
		memset(dfn, 0, sizeof(dfn));
		memset(low, 0, sizeof(low));
		tot = top = 0;
		memset(vect, 0, sizeof(vect));
		keyE.clear();
		keyV.clear();
	}
	void dfs(int u, int cnt){
		int part = (cnt > 1);
		st[top++] = u;
		dfn[u] = low[u] = cnt;
		for (int it = vect[u]; it; it = edge[it].next){
			int v = edge[it].v;
			if (!dfn[v]){
				dfs(v, cnt + 1);
				low[u] = min(low[u], low[v]);
				// cut edge
				if (low[v] > dfn[u]){
					keyE.push_back(MP(u, v));
				}
				// cut point
				if (low[v] >= dfn[u]){
					if (++part == 2) keyV.push_back(u);
					// BCC
					/*
					vector<int> now;
					A.push_back(u);
					for (st[top] = 0; st[top] != v; now.push_back(st[--top]));
					// gao(now)
					*/
				}
				
			}
			else if (dfn[v] != dfn[u] - 1)
				low[u] = min(low[u], dfn[v]);
		}
		//part 
		tmp = max(tmp, part);
	}
	void tarjan(int pia){
		// 1 ~ n;	
		for (int i = top = 0; i < n; i++){
			if (i == pia) continue;
			if (!dfn[i]){
				sum++;
				dfs(i, 1);
			}
		}
	}
};

int edge[5010][2];
int n, m;
BCC g;

int main()
{
	while(scanf("%d%d", &n, &m) != EOF){
		for (int i = 0; i < m; i++){
			scanf("%d%d", &edge[i][0], &edge[i][1]);
		}
		ans = 0;
		for (int i = 0; i < n; i++){
			g.init(n);
			tmp = sum = 0;
			for (int j = 0; j < m; j++){
				int u = edge[j][0];
				int v = edge[j][1];
				if (u == i || v == i) continue;
				g.add(u, v);
				g.add(v, u);
			}
			g.tarjan(i);
			//printf("%d %d\n", tmp, sum);
			ans = max(ans, tmp + sum - 1);
		}
		printf("%d\n", ans);
	}
    return 0;
}



    
