#include <bits/stdc++.h>

using namespace std;

#define fi first
#define se second

#define sz(a) int((a).size())
#define all(a) (a).begin(), (a).end()

#define msb(x) (31 - __builtin_clz(x))

using ll = long long;
using pii = pair<int, int>;

const int NMAX = 150005;
const int LOGN = 21;

int n, m;
vector<int> g[NMAX];
int parent[NMAX], depth[NMAX];
int rmq[LOGN][2 * NMAX], pos[NMAX];
vector<int> euler;

void dfs(int x = 0) {
   euler.push_back(x);
   pos[x] = sz(euler);
   for (auto y : g[x]) {
      if (parent[x] != y) {
         parent[y] = x;
         depth[y] = depth[x] + 1;
         dfs(y);
         euler.push_back(x);
      }
   }
}

int best(int x, int y) {
   return depth[x] < depth[y] ? x : y;
}

void rmq_build() {
   for (int i = 1; i <= sz(euler); i++) {
      rmq[0][i] = euler[i - 1];
   }
   for (int j = 1; 1 << j <= sz(euler); j++) {
      for (int i = 1; i + (1 << j) - 1 <= sz(euler); i++) {
         rmq[j][i] = best(rmq[j - 1][i], rmq[j - 1][i + (1 << (j - 1))]);
      }
   }
}

int lca(int x, int y) {
   x = pos[x];
   y = pos[y];
   if (x > y) swap(x, y);
   int k = msb(y - x + 1);
   return best(rmq[k][x], rmq[k][y - (1 << k) + 1]);
}

int dist(int x, int y) {
   return depth[x] + depth[y] - 2 * depth[lca(x, y)];
}

vector<int> solve(
   vector<pii> R,
   vector<ll> D,
   vector<int> S,
   vector<int> T,
   vector<bool> I
) {
   n = sz(R);
   m = sz(D);
   for (auto [ x, y ] : R) {
      g[x].push_back(y);
      g[y].push_back(x);
   }

   parent[0] = -1;
   dfs();
   rmq_build();

   vector<int> ans(m, 0);
   for (int i = 0; i < m; i++) {
      ans[i] = I[i] ? (dist(S[i], T[i]) + 1) : 0;
   }

#if 0
   priority_queue<tuple<ll, int, int>> pq;

   for (int i = 0; i < m; i++) {
      pq.emplace(-D[i], S[i], i);
   }

   while (!pq.empty()) {
      auto [ t, _, __ ] = pq.top();
      vector<tuple<ll, int, int>> v;

      while (!pq.empty() && get<0>(pq.top()) == t) {
         v.push_back(pq.top());
         pq.pop();
      }

      for (int i = 0, j; i < sz(v);) {
         auto [ _, x, __ ] = v[i];
         bool infected = false;
         for (j = i; j < sz(v); j++) {
            auto [ _, y, idx ] = v[j];
            if (y != x) break;
            infected |= I[idx];
         }
         for (j = i; j < sz(v); j++) {
            auto [ _, y, idx ] = v[j];
            if (y != x) break;
            I[idx] = I[idx] | infected;
            ans[idx] += I[idx];
            if (x != T[idx]) {
               pq.emplace(t - 1, nxt[idx][x], idx);
            }
         }
         i = j;
      }
   }
#endif

   return ans;
}

#ifdef LOCAL
signed main() {
   freopen("input.txt", "r", stdin);
   int n, m;
   cin >> n >> m;

   vector<pii> R(n - 1);
   vector<ll> D(m);
   vector<int> S(m), T(m);
   vector<bool> I(m);

   for (int i = 0; i < n - 1; i++) {
      cin >> R[i].fi >> R[i].se;
   }
   for (int i = 0; i < m; i++) {
      int val;
      cin >> D[i] >> S[i] >> T[i] >> val;
      I[i] = val;
   }

   auto ans = solve(R, D, S, T, I);
   for (auto it : ans) cout << it << endl;

   return 0;
}
#endif
