#include <bits/stdc++.h>
using namespace std;
const long long N = 1e9 + 7;
void sub() {}
void solve() {
  vector<unordered_set<int> > v;
  int i;
  int n, m;
  cin >> n >> m;
  int a, b;
  cin >> a >> b;
  unordered_set<int> f;
  f.insert(a);
  f.insert(b);
  v.push_back(f);
  for (i = 0; i < m - 1; i++) {
    cin >> a >> b;
    auto it = v.begin();
    for (; it != v.end(); it++) {
      if (it->find(a) != it->end()) break;
    }
    auto iu = v.begin();
    for (; iu != v.end(); iu++) {
      if (iu->find(b) != iu->end()) break;
    }
    if (it == v.end() && iu == v.end()) {
      unordered_set<int> s;
      s.insert(a);
      s.insert(b);
      v.push_back(s);
    } else if (it == v.end()) {
      iu->insert(a);
    } else if (iu == v.end()) {
      it->insert(b);
    } else if (iu != it) {
      it->insert(iu->begin(), iu->end());
    }
  }
  int max = 0;
  for (auto it = v.begin(); it != v.end(); it++)
    if (it->size() > max) max = it->size();
  cout << max << '\n';
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  sub();
  int t = 1;
  while (t--) solve();
  return 0;
}
