#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> vec[n];
  for (int i = 0; i < m; i++) {
    int f, s;
    cin >> f >> s;
    vec[f - 1].push_back(s - 1);
    vec[s - 1].push_back(f - 1);
  }
  bool loopAgain = true;
  int numOfGroups = 0;
  while (loopAgain) {
    set<int> kikedOut;
    loopAgain = false;
    numOfGroups++;
    for (int i = 0; i < n; i++) {
      if (vec[i].size() == 1) {
        kikedOut.insert(i);
        loopAgain = true;
      }
    }
    for (int i = 0; i < n; i++) {
      for (set<int>::iterator j = kikedOut.begin(); j != kikedOut.end(); j++) {
        vec[*j].clear();
        vec[i].erase(remove(vec[i].begin(), vec[i].end(), *j), vec[i].end());
      }
    }
  }
  cout << --numOfGroups;
  return 0;
}
