import java.io.*;
import java.util.*;

public class graphtail_pk_40 {
	public static void main(String[] args) {
		new graphtail_pk_40().run();
	}

	BufferedReader br;
	StringTokenizer in;
	PrintWriter out;

	public String nextToken() throws IOException {
		while (in == null || !in.hasMoreTokens()) {
			in = new StringTokenizer(br.readLine());
		}
		return in.nextToken();
	}

	public int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	public long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	public double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}

	public void solve() throws IOException {
		int n = nextInt();
		int m = nextInt();
		assert((1 <= n) && (n <= 100));
		assert((1 <= m) && (m <= 1000));
		ArrayList<Integer>[] e = new ArrayList[n];
		for (int i = 0; i < n; i++) {
			e[i] = new ArrayList<Integer>();
		}
		for (int i = 0; i < m; i++) {
			int a = nextInt() - 1;
			int b = nextInt() - 1;
			e[a].add(b);
			e[b].add(a);
			assert((0 <= a) && (a < n));
			assert((0 <= b) && (b < n));
		}
		int ans = 0;
		for (int i = 0; i < n; i++) {
			if (e[i].size() > 1)
				continue;
			int p = i;
			int t = e[i].get(0);
			int k = 1;
			while (e[t].size() == 2) {
				int ot = t;
				if (e[t].get(0) != p)
					t = e[t].get(0);
				else
					t = e[t].get(1);
				p = ot;
				k++;
			}
			if (e[t].size() == 1)
				k++;
			if (k > ans)
				ans = k;
		}
		out.println(ans);
	}

	public void run() {
		try {
			br = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			br = new BufferedReader(new FileReader("graphtail.in"));
			out = new PrintWriter("graphtail.out");

			solve();

			out.close();
		} catch (IOException e) {
			e.printStackTrace();
			System.exit(1);
		}
	}
}