#include <bits/stdc++.h>
using namespace std;
void fast() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}
int main() {
  long long n;
  cin >> n;
  ;
  long long m;
  cin >> m;
  ;
  vector<pair<long long, long long> > p(m);
  vector<long long> v(n + 1);
  vector<long long> k(n + 1, 1);
  for (int i = 0; i < int(m); i++) {
    cin >> p[i].first >> p[i].second;
    v[p[i].first]++;
    v[p[i].second]++;
  }
  int d = 1, gp = 0, itr = 1;
  bool flag = true;
  while (flag) {
    flag = false;
    for (int i = 0; i < int(m); i++) {
      if ((v[p[i].first] == 1 && k[p[i].first] == d && v[p[i].second]) ||
          (v[p[i].second] == 1 && k[p[i].second] == d && v[p[i].first])) {
        flag = true;
        gp = itr;
        v[p[i].first]--;
        v[p[i].second]--;
        k[p[i].first] = -d;
        k[p[i].second] = -d;
      }
    }
    d *= -1;
    itr++;
  }
  cout << gp << "\n";
}
