#include <bits/stdc++.h>
using namespace std;
struct road {
  int x, next;
  int dis, val, del;
} r[100005 * 2];
int N, M, lt, rt;
int st[100005], w = 1;
int size[100005], dist[100005], all;
int f1, r1, mxd, bt;
int last[100005], q[100005], fa[100005], sum[100005];
int vis[100005], g[100005], f[100005], flag;
int dd[100005], a1, b1;
int len[100005], rk[100005], son[100005];
int ans1, ans2;
void add(int x, int y, int dis) {
  r[++w].x = y, r[w].del = x;
  r[w].dis = dis;
}
void Calc(int x, int fr) {
  size[x] = 1;
  for (int i = st[x]; i; i = r[i].next)
    if (!r[i].del && r[i].x != fr) Calc(r[i].x, x), size[x] += size[r[i].x];
}
void Find_root(int& x) {
  int i, tmp, y = 0;
  size[x] = 1;
  for (i = st[x]; i; i = r[i].next) {
    tmp = r[i].x;
    if (r[i].del) continue;
    size[x] += size[tmp];
    if ((!y) || size[y] < size[tmp]) y = tmp;
  }
  if (size[y] > size[x] / 2) size[x] -= size[y], x = y, Find_root(x);
}
bool Ask(int& n, int m) {
  int i, j = 0, tmp;
  a1 = 1, b1 = 0;
  for (i = m; i >= lt - n; i--)
    if (g[i]) {
      while (i + j <= rt && j <= n) {
        while (a1 <= b1 &&
               ((vis[dd[b1]] != flag || sum[f[j]] > sum[f[dd[b1]]])))
          b1--;
        dd[++b1] = j++;
      }
      while (a1 <= b1 && dd[a1] + i < lt) a1++;
      if (a1 <= b1 && vis[dd[a1]] == flag && sum[g[i]] + sum[f[dd[a1]]] >= 0) {
        ans1 = g[i], ans2 = f[dd[a1]];
        return true;
      }
    }
  n = m;
  for (i = 1; i <= m; i++)
    if (((vis[i] != flag || sum[g[i]] > sum[f[i]]))) f[i] = g[i], vis[i] = flag;
  return false;
}
void Init(int x, int fr, int deep, int ad) {
  int i, tmp;
  sum[x] = ad, mxd = max(mxd, deep);
  if ((!g[deep]) || sum[x] > sum[g[deep]]) g[deep] = x;
  for (i = st[x]; i; i = r[i].next)
    if (!r[i].del && r[i].x != fr) Init(r[i].x, x, deep + 1, ad + r[i].val);
}
bool scmp(int a, int b) { return size[r[a].x] < size[r[b].x]; }
bool Dfs(int x) {
  int i, tmp, get = 0, stot, lim;
  Find_root(x);
  for (i = st[x], stot = 0; i; i = r[i].next)
    if (!r[i].del) son[++stot] = i;
  sort(son + 1, son + 1 + stot, scmp);
  f[dist[x] = 0] = x, vis[0] = x;
  for (i = 1, flag = x, bt = 0; i <= stot; i++) {
    tmp = r[son[i]].x, mxd = 0;
    r[son[i]].del = r[son[i] ^ 1].del = 1;
    lim = min(size[tmp], rt), memset(g, 0, lim * 4 + 4);
    Init(tmp, x, 1, r[son[i]].val);
    get = Ask(bt, mxd);
    if (get) return true;
    r[son[i]].del = r[son[i] ^ 1].del = 0;
  }
  for (i = st[x]; i; i = r[i].next) {
    tmp = r[i].x;
    if (r[i].del) continue;
    r[i].del = r[i ^ 1].del = 1;
    get = Dfs(tmp);
    r[i].del = r[i ^ 1].del = 0;
    if (get) return true;
  }
  return false;
}
bool Check(int x) {
  int i, j;
  memset(vis, 0, sizeof(vis));
  sum[0] = -0x7ffffff;
  for (i = 2; i <= w; i++) {
    if (r[i].dis >= len[x])
      r[i].val = 1;
    else
      r[i].val = -1;
    r[i].del = 0;
  }
  Calc(1, -1);
  return Dfs(1);
}
int main() {
  int i, j;
  int fr, to, dis;
  int l1 = 1, r1 = 0, mid;
  scanf("%d %d %d", &N, &lt, &rt);
  for (i = 1; i < N; i++) {
    scanf("%d %d %d", &fr, &to, &dis);
    add(fr, to, dis);
    len[i] = dis;
  }
  random_shuffle(r + 2, r + 1 + w);
  for (i = w; i >= 2; i--) {
    r[i * 2 - 2] = r[i * 2 - 1] = r[i];
    swap(r[i * 2 - 1].del, r[i * 2 - 1].x);
  }
  w = w * 2 - 1;
  for (i = 2; i <= w; i++) r[i].next = st[r[i].del], st[r[i].del] = i;
  sort(len + 1, len + N);
  for (i = 1, r1 = 0; i < N; i++)
    if (len[i] != len[i - 1]) len[++r1] = len[i];
  while (l1 <= r1) {
    mid = (l1 + r1) / 2;
    if (Check(mid))
      l1 = mid + 1;
    else
      r1 = mid - 1;
  }
  Check(r1);
  printf("%d %d\n", ans1, ans2);
  return 0;
}
