#include <bits/stdc++.h>
using namespace std;
const long long dx[] = {0, -1, 0, 1};
const long long dy[] = {-1, 0, 1, 0};
const long long INF = 2e17 + 5;
const long long nax = 3e5 + 5;
const long long M = 1e17 + 7;
void mini(long long &a, long long b) { a = min(a, b); }
void maxi(long long &a, long long b) { a = max(a, b); }
long long distsq(pair<long long, long long> a, pair<long long, long long> b) {
  return (a.first - b.first) * (a.first - b.first) +
         (a.second - b.second) * (a.second - b.second);
}
void solve() {
  long long n, m;
  cin >> n >> m;
  vector<long long> deg(n + 1);
  map<long long, set<long long>> g, ng;
  for (long long i = 1; i <= m; i++) {
    long long x, y;
    cin >> x >> y;
    deg[x]++, deg[y]++;
    g[x].insert(y);
    g[y].insert(x);
  }
  long long ans = 0, cnt = 0;
  while (1) {
    vector<long long> d1;
    for (long long u = 1; u <= n; u++)
      if (deg[u] == 1) d1.push_back(u);
    ans = 0;
    for (long long u : d1) {
      ans++;
      long long v = *g[u].begin();
      deg[u]--, deg[v]--;
      g[u].erase(v);
      g[v].erase(u);
    }
    if (!ans)
      break;
    else
      cnt++;
  }
  cout << cnt;
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cerr.tie(0);
  ;
  long long tt = 1;
  while (tt--) {
    solve();
  }
  return 0;
}
