#include <bits/stdc++.h>
const double pi = 3.14159265359;
const int MOD = 1000000007;
double sinA(double dig) { return sin(dig * pi / 180); }
double cosA(double dig) { return cos(dig * pi / 180); }
double tanA(double dig) {
  int we = dig;
  if (we == dig) {
    if (we % 90 == 0) {
      if ((we / 90) % 2 == 1)
        std::cout << "ERROR\n";
      else
        return 0;
    }
  }
  return tan(dig * pi / 180);
}
double secA(double dig) {
  int qw = cos(dig * pi / 180);
  if (qw == 0)
    std::cout << "ERROR\n";
  else
    return (1 / qw);
}
double cosecA(double dig) {
  int qw = sin(dig * pi / 180);
  if (qw == 0)
    std::cout << "ERROR\n";
  else
    return (1 / qw);
}
double cotA(double dig) {
  int qw = tan(dig * pi / 180);
  if (qw == 0)
    std::cout << "ERROR\n";
  else
    return (1 / qw);
}
bool isPrime(long long num) {
  if (num < 0) num *= -1;
  if (num == 1 || num == 0)
    return false;
  else if (num == 2)
    return true;
  else {
    if (num % 2 == 0) {
      return false;
    } else
      for (int x = 3; x <= sqrt(num); x += 2) {
        if (num % x == 0) {
          return false;
        }
      }
    return true;
  }
}
long long gcd(long long A, long long B) {
  if (B == 0) return A;
  return gcd(B, A % B);
}
long long lcm(long long f, long long l) { return (f / gcd(f, l) * l); }
long long fact(long long number) {
  if (number < 0) number *= -1;
  if (number == 0) return 1;
  if (number == 1)
    return number;
  else
    return number * fact(number - 1);
}
long long fib(long long n) {
  auto sqrt_5 = std::sqrt(5);
  if (n == 0) return 0;
  if (n == 1) return 1;
  return static_cast<long long>(
      (std::pow(1 + sqrt_5, n) - std::pow(1 - sqrt_5, n)) /
      (std::pow(2, n) * sqrt_5));
}
long long cdiv(long long a, long long b) {
  return a / b + ((a ^ b) > 0 && a % b);
}
long long fdiv(long long a, long long b) {
  return a / b - ((a ^ b) < 0 && a % b);
}
int power(int x, int n) {
  if (n == 0) return 1;
  int temp = power(x, n / 2);
  temp *= temp;
  if (n % 2) temp *= x;
  return temp;
}
long long powerMOD(long long x, long long n, long long m) {
  if (n == 0) return (1);
  long long temp = power(x, n / 2);
  temp = ((temp % m) * (temp % m)) % m;
  if (n % 2) temp = ((temp % m) * (x % m)) % m;
  return temp;
}
int ETF(int n) {
  int ans = 1;
  for (int x = 2; x * x <= n; x++) {
    if (n % x == 0) {
      int count = 0;
      while (n % x == 0) {
        count++;
        n /= x;
      }
      ans *= (power(x, count - 1) * (x - 1));
    }
  }
  if (n != 1) ans *= (n - 1);
  return ans;
}
long long SUM(long long number) {
  long long ans = 0;
  while (number) {
    ans += number % 10;
    number /= 10;
  }
  return ans;
}
const long long N = 200070;
std::map<long long, long long> f;
long long fibb(long long n) {
  if (f.count(n)) return f[n];
  if (n == 0) return 0;
  if (n == 1 || n == 2) return 1;
  if (n % 2 == 0) {
    long long k = n / 2;
    long long ret1 = fibb(k - 1), ret2 = fibb(k);
    return f[n] = ((((2ll * ret1) % MOD + ret2) % MOD) * ret2) % MOD;
  } else {
    long long k = (n + 1) / 2;
    long long ret1 = fibb(k - 1), ret2 = fibb(k);
    return f[n] = ((ret1 * ret1) % MOD + (ret2 * ret2) % MOD) % MOD;
  }
}
int sumOfNumber(std::string namee) {
  int sum = 0;
  for (char x : namee) {
    sum += (x - '0');
  }
  return sum;
}
int bits(std::string name1, std::string name2) {
  int num = name1.size();
  int ans = 0;
  for (int x = 0; x < num; x++) {
    if (name1[x] != name2[x]) ans++;
  }
  return ans;
}
using namespace std;
void solve() {
  int N, M;
  scanf("%d%d", &N, &M);
  vector<set<int> > tie(N + 1);
  int a, b;
  while (M--) {
    scanf("%d%d", &a, &b);
    tie[a].insert(b);
    tie[b].insert(a);
  }
  int groups = 0;
  while (1) {
    vector<int> v;
    for (int i = 1; i <= N; i++) {
      if (tie[i].size() == 1) v.push_back(i);
    }
    for (int i = 0; i < (int)v.size(); i++) {
      set<int>::iterator it = tie[v[i]].begin();
      tie[v[i]].clear();
      tie[*it].erase(v[i]);
    }
    if (v.size())
      groups++;
    else
      break;
  }
  printf("%d", groups);
}
int main() {
  std::ios_base::sync_with_stdio(false), std::cout.tie(0), std::cin.tie(0);
  ;
  solve();
}
