#include <bits/stdc++.h>
using namespace std;
template <class D>
void read(D& res) {
  res = 0;
  register D g = 1;
  register char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') g = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    res = (res << 3) + (res << 1) + (ch ^ 48);
    ch = getchar();
  }
  res *= g;
}
const int INF = 1e9 + 7;
vector<int> t[101000];
struct E {
  int to, nt, w, v;
} e[202000];
int n, m, rot, L, R, M, sn, head[101000], tot, X, Y, W;
int siz[101000], vis[101000], dep[101000], mx[101000], val[101000], a[101000],
    pa[101000], b[101000], pb[101000], q[101000], hed, tal, N, maxi, root;
int A, B;
vector<int> son;
void add(int x, int y, int w) {
  e[++tot].to = y;
  e[tot].nt = head[x];
  head[x] = tot;
  e[tot].w = w;
}
void findroot(int x, int fa) {
  siz[x] = 1;
  mx[x] = 0;
  for (int k = head[x]; k != -1; k = e[k].nt) {
    if (e[k].to == fa || vis[e[k].to]) continue;
    findroot(e[k].to, x);
    siz[x] += siz[e[k].to];
    mx[x] = max(mx[x], siz[e[k].to]);
  }
  mx[x] = max(mx[x], N - siz[x]);
  if (mx[x] < maxi) maxi = mx[x], root = x;
}
void D_1(int x, int fa) {
  siz[x] = 1;
  for (int k = head[x]; k != -1; k = e[k].nt) {
    if (e[k].to == fa || vis[e[k].to]) continue;
    D_1(e[k].to, x);
    siz[x] += siz[e[k].to];
  }
}
void divided(int x, int fa) {
  if (fa) t[fa].emplace_back(x);
  vis[x] = 1;
  D_1(x, 0);
  for (int k = head[x]; k != -1; k = e[k].nt) {
    if (e[k].to == fa || vis[e[k].to]) continue;
    N = siz[e[k].to];
    maxi = INF;
    findroot(e[k].to, x);
    divided(root, x);
  }
}
void D_2(int x, int fa, int depth) {
  dep[x] = depth;
  mx[x] = depth;
  for (int k = head[x]; k != -1; k = e[k].nt) {
    if (e[k].to == fa || vis[e[k].to]) continue;
    val[e[k].to] = val[x] + e[k].v;
    D_2(e[k].to, x, depth + 1);
    mx[x] = max(mx[x], mx[e[k].to]);
  }
}
inline bool bbb(int x, int y) { return mx[x] < mx[y]; }
void D_3(int x, int fa) {
  if (val[x] > b[dep[x]]) b[dep[x]] = val[x], pb[dep[x]] = x;
  for (int k = head[x]; k != -1; k = e[k].nt) {
    if (e[k].to == fa || vis[e[k].to]) continue;
    D_3(e[k].to, x);
  }
}
void conquer(int x) {
  if (sn) return;
  son.clear();
  val[x] = 0;
  D_2(x, 0, 0);
  for (int k = head[x]; k != -1; k = e[k].nt) {
    if (vis[e[k].to]) continue;
    son.emplace_back(e[k].to);
  }
  sort(son.begin(), son.end(), bbb);
  for (int i = 0; i <= mx[x]; i++) a[i] = b[i] = -INF, pa[i] = pb[i] = 0;
  maxi = 0;
  a[0] = 0;
  pa[0] = x;
  for (auto d : son) {
    for (int i = 1; i <= mx[d]; i++) b[i] = -INF, pb[i] = 0;
    D_3(d, x);
    hed = 1;
    tal = 0;
    for (int i = min(R - 1, maxi); i >= L - 1; i--) {
      if (a[i] == -INF) continue;
      while (hed <= tal && a[q[tal]] <= a[i]) tal--;
      q[++tal] = i;
    }
    for (int i = 1; i <= mx[d]; i++) {
      while (hed <= tal && q[hed] + i > R) {
        hed++;
      }
      if (L - i <= maxi && L >= i && a[L - i] > -INF) {
        while (hed <= tal && a[q[tal]] <= a[L - i]) {
          tal--;
        }
        q[++tal] = L - i;
      }
      if (hed <= tal && b[i] + a[q[hed]] >= 0) {
        sn = 1, A = pa[q[hed]], B = pb[i];
      }
    }
    for (int i = 1; i <= mx[d]; i++) {
      if (a[i] < b[i]) a[i] = b[i], pa[i] = pb[i];
    }
    maxi = mx[d];
  }
  vis[x] = 1;
  for (auto d : t[x]) conquer(d);
}
int ck(int lim) {
  for (int i = 1; i <= n; i++)
    for (int k = head[i]; k != -1; k = e[k].nt) {
      if (e[k].w < lim)
        e[k].v = -1;
      else
        e[k].v = 1;
    }
  for (int i = 1; i <= n; i++) vis[i] = 0;
  sn = 0;
  conquer(rot);
  return sn;
}
void dichotomize(int l, int r) {
  if (l == r) {
    return ck(l), void();
  }
  int mid = (l + r + 1) >> 1;
  if (ck(mid))
    dichotomize(mid, r);
  else
    dichotomize(l, mid - 1);
}
int main() {
  read(n);
  read(L);
  read(R);
  memset(head, -1, sizeof(head));
  tot = -1;
  for (int i = 1; i <= n - 1; i++) {
    read(X);
    read(Y);
    read(W);
    add(X, Y, W);
    add(Y, X, W);
    M = max(M, W);
  }
  N = n;
  maxi = INF;
  findroot(1, 0);
  rot = root;
  divided(root, 0);
  dichotomize(0, M);
  printf("%d %d", A, B);
  return 0;
}
