#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
inline long long modMul(long long a, long long b) {
  return ((a % mod) * (b % mod)) % mod;
}
inline long long modAdd(long long a, long long b) {
  return ((a % mod) + (b % mod)) % mod;
}
inline long long modPow(long long b, long long p) {
  long long r = 1;
  while (p) {
    if (p & 1) r = modMul(r, b);
    b = modMul(b, b);
    p >>= 1;
  }
  return r;
}
inline long long modInverse(long long a) { return modPow(a, mod - 2); }
inline long long modDiv(long long a, long long b) {
  return modMul(a, modInverse(b));
}
long long const maxn = 1000001;
long long fact[1000006];
long long inv[1000006];
long long gcd(long long x, long long y) {
  if (x == 0) {
    return y;
  }
  return gcd(y % x, x);
}
long long lcm(long long a, long long b) { return (a * b) / gcd(a, b); }
bool prime[100001];
bool comp(long long a, long long b) { return a > b; }
long long npr(long long n, long long r) {
  long long ans = n;
  long long x = n - r;
  while (n > x + 1) {
    n--;
    ans = modMul(ans, n);
  }
  return (ans) % mod;
}
void factorial() {
  fact[0] = 1;
  fact[1] = 1;
  for (long long i = 2; i < 1000006; i++) {
    fact[i] = modMul(fact[i - 1], i);
  }
}
long long ncr(long long n, long long r) {
  if (r > n) {
    return 0;
  }
  long long ans = fact[n];
  ans = modMul(ans, modInverse(fact[r]));
  ans = modMul(ans, modInverse(fact[n - r]));
  return ans;
}
vector<long long> pfactor(maxn);
void getprimefactors() {
  pfactor[1] = 1;
  for (long long i = 2; i < maxn; i++) {
    if (i % 2 == 0) {
      pfactor[i] = 2;
    } else {
      pfactor[i] = i;
    }
  }
  for (long long i = 3; i < maxn; i = i + 2) {
    if (pfactor[i] == i) {
      for (long long j = i * i; j < maxn; j += i) {
        if (pfactor[j] == j) {
          pfactor[j] = i;
        }
      }
    }
  }
}
vector<long long> adj[10001];
bool visited[10001];
void solve() {
  long long n;
  long long m;
  cin >> n >> m;
  long long degree[n + 1];
  memset(degree, 0, sizeof(degree));
  memset(visited, false, sizeof(visited));
  degree[0] = 0;
  for (long long i = 0; i < m; i++) {
    long long source;
    long long dest;
    cin >> source >> dest;
    adj[source].push_back(dest);
    adj[dest].push_back(source);
    degree[source] += 1;
    degree[dest] += 1;
  }
  queue<long long> q;
  long long ans = 0;
  while (true) {
    for (long long i = 1; i < n + 1; i++) {
      if (degree[i] == 1) {
        q.push(i);
      }
    }
    if (q.size() == 0) {
      cout << ans << endl;
      return;
    }
    ans++;
    while (q.size() > 0) {
      long long x = q.front();
      q.pop();
      visited[x] = true;
      degree[x] -= 1;
      for (long long i = 0; i < adj[x].size(); i++) {
        long long k = adj[x][i];
        if (!visited[k]) {
          degree[adj[x][i]]--;
        }
      }
    }
  }
  cout << ans << endl;
}
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  long long test = 1;
  while (test--) {
    solve();
  }
  return 0;
}
