#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, x, y;
  cin >> n >> m;
  set<int> adj[n];
  for (int i = 0; i < m; i++) {
    cin >> x >> y;
    adj[x - 1].insert(y - 1);
    adj[y - 1].insert(x - 1);
  }
  int grp = 0;
  bool kick = 0;
  while (true) {
    set<int> rm;
    for (int i = 0; i < n; i++) {
      if (adj[i].size() == 1) {
        kick = 1;
        rm.insert(i);
        adj[i].erase(adj[i].begin());
      }
    }
    for (int i = 0; i < n; i++) {
      for (auto it = adj[i].begin(); it != adj[i].end();) {
        if (rm.find(*it) != rm.end())
          it = adj[i].erase(it);
        else
          ++it;
      }
    }
    if (!kick) break;
    kick = 0;
    grp++;
    rm.erase(rm.begin(), rm.end());
  }
  cout << grp << "\n";
}
