#include <bits/stdc++.h>
using namespace std;
void print_adj_list(vector<vector<int>> vec) {
  cout << endl;
  for (int i = 0; i < vec.size(); i++) {
    for (int j = 0; j < vec[i].size(); j++) {
      cout << vec[i][j] << " ";
    }
    cout << endl;
  }
  cout << endl;
}
void print_v(vector<int> b) {
  cout << endl;
  for (int i = 0; i < b.size(); ++i) {
    cout << b[i] << " ";
  }
  cout << endl;
}
void print_s(stack<pair<int, int>> s) {
  cout << endl;
  while (!s.empty()) {
    pair<int, int> temp;
    temp = s.top();
    cout << temp.first << " " << temp.second << endl;
    s.pop();
  }
  cout << endl;
}
int main() {
  int n, m;
  int n_in, m_in;
  cin >> n >> m;
  vector<vector<int>> data(n, vector<int>());
  vector<int> count(n);
  queue<pair<int, int>> groups;
  for (int i = 0; i < m; i++) {
    cin >> n_in >> m_in;
    data[n_in - 1].push_back(m_in - 1);
    count[n_in - 1]++;
    data[m_in - 1].push_back(n_in - 1);
    count[m_in - 1]++;
  }
  int gen = 1;
  bool flag = true;
  while (flag) {
    flag = false;
    for (int i = 0; i < count.size(); i++) {
      if (count[i] == 1) {
        pair<int, int> aux;
        aux.first = i + 1;
        aux.second = gen;
        groups.push(aux);
        flag = true;
      }
    }
    while (!groups.empty()) {
      pair<int, int> temp;
      temp = groups.front();
      count[temp.first - 1]--;
      for (int aux = 0; aux < data[temp.first - 1].size(); aux++) {
        if (count[data[temp.first - 1][aux]] != 0) {
          count[data[temp.first - 1][aux]]--;
          break;
        }
      }
      groups.pop();
    }
    gen++;
  }
  cout << gen - 2 << endl;
  return 0;
}
