#include <bits/stdc++.h>
inline int getint() {
  int x = 0, p = 1;
  char c;
  c = getchar();
  while (c <= 32) c = getchar();
  if (c == 45) p = -p, c = getchar();
  while (c > 32) x = x * 10 + c - 48, c = getchar();
  return x * p;
}
using namespace std;
const int maxn = 1e5 + 5;
const int base = 1e5 + 5;
int n, L, R, ison[maxn], res[2], m = 1;
vector<int> E;
vector<pair<int, int> > G[maxn];
vector<pair<int, pair<int, int> > > vv;
bool is_centroid[maxn];
namespace T {
pair<int, int> dat[maxn << 2];
inline void finit(int _n) {
  m = 1;
  while (m < _n) m <<= 1;
  for (int(i) = 0; (i) < (2 * m - 1); (i)++)
    dat[i] = make_pair(-1000000000, -1);
}
inline void fM(int x, pair<int, int> del) {
  x += m - 1;
  if (del > dat[x]) {
    dat[x] = max(dat[x], del);
    while (x > 0) {
      x = (x - 1) / 2;
      dat[x] = max(dat[2 * x + 1], dat[2 * x + 2]);
    }
  }
}
pair<int, int> fQ(int x, int y, int l, int r, int k) {
  if (y <= l || x >= r || x >= y)
    return make_pair(-1000000000, -1);
  else if (x <= l && r <= y)
    return dat[k];
  else {
    pair<int, int> lx = fQ(x, y, l, (l + r) >> 1, 2 * k + 1);
    pair<int, int> ly = fQ(x, y, (l + r) >> 1, r, 2 * k + 2);
    return max(lx, ly);
  }
}
}  // namespace T
pair<int, pair<int, int> > get_ans(int x, int p, int len, int ok, int val) {
  pair<int, int> buf = T::fQ(max(L - len, 0), min(R - len + 1, m), 0, m, 0);
  pair<int, pair<int, int> > ans =
      make_pair(buf.first + ok, make_pair(buf.second, x));
  if (ans.first >= 0)
    return ans;
  else {
    vv.push_back(make_pair(len, make_pair(ok, x)));
    if (len + 1 > R) return make_pair(-1000000000, make_pair(-1000000000, -1));
    for (int(i) = 0; (i) < (G[x].size()); (i)++) {
      int y = G[x][i].second, llen = G[x][i].first;
      if (y == p || is_centroid[y]) continue;
      ans = get_ans(y, x, len + 1, ok + ((llen >= val) ? 1 : -1), val);
      if (ans.first >= 0) return ans;
    }
  }
  return make_pair(-1000000000, make_pair(-1000000000, -1));
}
int cnt_son(int x, int p) {
  int c = 1;
  for (int(i) = 0; (i) < (G[x].size()); (i)++) {
    int y = G[x][i].second;
    if (y == p || is_centroid[y]) continue;
    c += cnt_son(y, x);
  }
  return ison[x] = c;
}
pair<int, int> get_centroid(int x, int p, int tot) {
  pair<int, int> ans = make_pair(1000000000, -1);
  int c = 0, ileft = 1;
  for (int(i) = 0; (i) < (G[x].size()); (i)++) {
    int y = G[x][i].second;
    if (y == p || is_centroid[y]) continue;
    ans = min(ans, get_centroid(y, x, tot));
    ileft += ison[y];
    c = max(c, ison[y]);
  }
  c = max(c, tot - ileft);
  ans = min(ans, make_pair(c, x));
  return ans;
}
pair<int, pair<int, int> > work(int x, int val) {
  cnt_son(x, -1);
  pair<int, int> u = get_centroid(x, -1, ison[x]);
  int tot = u.first, s = u.second;
  is_centroid[s] = true;
  for (int(i) = 0; (i) < (G[s].size()); (i)++) {
    int y = G[s][i].second;
    if (is_centroid[y]) continue;
    pair<int, pair<int, int> > ans = work(y, val);
    if (ans.first >= 0) return ans;
  }
  T::finit(tot + 1);
  T::fM(0, make_pair(0, s));
  for (int(i) = 0; (i) < (G[s].size()); (i)++) {
    vv.clear();
    int y = G[s][i].second, len = G[s][i].first;
    if (is_centroid[y]) continue;
    pair<int, pair<int, int> > ans =
        get_ans(y, s, 1, ((len >= val) ? 1 : -1), val);
    if (ans.first >= 0) return ans;
    for (int(i) = 0; (i) < (vv.size()); (i)++)
      T::fM(vv[i].first, make_pair(vv[i].second.first, vv[i].second.second));
  }
  is_centroid[s] = false;
  return make_pair(-1000000000, make_pair(-1, -1));
}
int main() {
  n = getint();
  L = getint();
  R = getint();
  for (int(i) = 0; (i) < (n - 1); (i)++) {
    int x, y, z;
    x = getint();
    y = getint();
    z = getint();
    x--;
    y--;
    G[x].push_back(make_pair(z, y));
    G[y].push_back(make_pair(z, x));
    E.push_back(z);
  }
  sort(E.begin(), E.end());
  E.resize(unique(E.begin(), E.end()) - E.begin());
  int lb = 0, rb = E.size();
  if (rb - lb == 1) {
    pair<int, int> ans = work(0, E[0]).second;
    res[0] = ans.first;
    res[1] = ans.second;
  } else
    while (rb - lb > 1) {
      int mid = (lb + rb) >> 1;
      int val = E[mid];
      memset(is_centroid, 0, sizeof(is_centroid));
      pair<int, pair<int, int> > ans = work(0, val);
      if (ans.first >= 0) {
        lb = mid;
        res[0] = ans.second.first;
        res[1] = ans.second.second;
      } else
        rb = mid;
    }
  for (int(i) = 0; (i) < (2); (i)++) printf("%d ", res[i] + 1);
  return 0;
}
