#include <bits/stdc++.h>
using namespace std;
const int DIM = 1e5 + 5;
int szt[DIM], dp1[DIM], dp2[DIM], lev[DIM];
vector<pair<int, int>> edg[DIM];
pair<int, int> lst[DIM], axl[DIM];
bitset<DIM> oki, axo;
vector<int> aux, cen;
inline int g(int x, int y) { return (x >= y) ? 1 : -1; }
void findcent(int x, int f, int sz, int &c) {
  int mx = 0;
  szt[x] = lev[x] = 1;
  for (pair<int, int> y : edg[x]) {
    if (y.first == f or oki[y.first]) continue;
    findcent(y.first, x, sz, c);
    lev[x] = max(lev[x], 1 + lev[y.first]);
    mx = max(mx, szt[y.first]);
    szt[x] += szt[y.first];
  }
  mx = max(mx, sz - szt[x]);
  if (mx <= sz / 2) c = x;
}
void predfs(int x, int sz) {
  findcent(x, 0, sz, x);
  findcent(x, 0, sz, x);
  sort(edg[x].begin(), edg[x].end(), [](pair<int, int> e1, pair<int, int> e2) {
    return lev[e1.first] < lev[e2.first];
  });
  cen.push_back(x);
  oki[x] = true;
  for (pair<int, int> y : edg[x])
    if (!oki[y.first]) predfs(y.first, szt[y.first]);
}
void dfs(int x, int f, int val, int l, int c, int &nr, int r) {
  if (l > r) return;
  if (!axo[l]) axl[l] = make_pair(c, x), nr = l, axo[l] = true;
  if (axl[l].first < c) axl[l] = make_pair(c, x);
  for (pair<int, int> y : edg[x])
    if (y.first != f and !oki[y.first])
      dfs(y.first, x, val, l + 1, c + g(y.second, val), nr, r);
}
pair<int, int> solve(int val, int l, int r) {
  for (int x : cen) {
    oki[x] = true;
    if (szt[x] <= l) continue;
    int len = 0;
    lst[0] = make_pair(0, x);
    dp1[0] = dp2[0] = 0;
    for (pair<int, int> y : edg[x]) {
      if (oki[y.first]) continue;
      int nr = 0;
      for (int i = 1; axo[i]; ++i) axo[i] = 0;
      dfs(y.first, x, val, 1, g(y.second, val), nr, r);
      for (int i = 1; i <= min(nr, r); ++i) {
        int pos1 = max(0, l - i), pos2 = r - i;
        if (pos2 > len) {
          if (axl[i].first + lst[dp2[pos1]].first >= 0 and pos1 <= len)
            return make_pair(axl[i].second, lst[dp2[pos1]].second);
        } else {
          if (axl[i].first + lst[dp1[pos2]].first >= 0)
            return make_pair(axl[i].second, lst[dp1[pos2]].second);
        }
      }
      for (int i = 1; i <= nr; ++i) {
        if (i > len) lst[++len] = make_pair(-1e9, -1e9);
        if (lst[i].first < axl[i].first) lst[i] = axl[i];
      }
      deque<int> que;
      for (int i = 0; i <= len; ++i) {
        while (que.size() and lst[que.back()].first < lst[i].first)
          que.pop_back();
        que.push_back(i);
        if (que.front() == i - (r - l + 1)) que.pop_front();
        dp1[i] = que.front();
      }
      for (int i = len; i >= 0; --i) {
        dp2[i] = i;
        if (i < len and lst[i].first < lst[dp2[i + 1]].first)
          dp2[i] = dp2[i + 1];
      }
    }
  }
  return make_pair(-1, -1);
}
int main(void) {
  ios ::sync_with_stdio(false);
  cin.tie();
  cout.tie();
  int n, l, r;
  cin >> n >> l >> r;
  for (int i = 1; i < n; ++i) {
    int x, y, c;
    cin >> x >> y >> c;
    aux.push_back(c);
    edg[x].push_back(make_pair(y, c));
    edg[y].push_back(make_pair(x, c));
  }
  sort(aux.begin(), aux.end());
  predfs(1, n);
  aux.resize(unique(aux.begin(), aux.end()) - aux.begin());
  pair<int, int> val;
  for (int le = 0, ri = (int)aux.size() - 1; le <= ri;) {
    int md = (le + ri) >> 1;
    oki.reset();
    pair<int, int> axv = solve(aux[md], l, r);
    if (axv.first == -1)
      ri = md - 1;
    else
      le = md + 1, val = axv;
  }
  cout << val.first << " " << val.second << endl;
  return 0;
}
