#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100005;
struct EDGE {
  int num, next, w;
} e[MAXN * 2];
int en = 0, start[MAXN];
inline void Add_edge(int p, int q, int r) {
  en++;
  e[en].num = q;
  e[en].next = start[p];
  start[p] = en;
  e[en].w = r;
  en++;
  e[en].num = p;
  e[en].next = start[q];
  start[q] = en;
  e[en].w = r;
}
int n, L, R;
int ans = -1, ans_start, ans_end;
int stk[MAXN], top = 0;
bool u[MAXN];
int size[MAXN], maxch[MAXN];
void Clr() {
  for (int i = 1; i <= top; i++) u[stk[i]] = false;
  top = 0;
}
void dfs(int p) {
  u[p] = true;
  stk[++top] = p;
  size[p] = 1;
  maxch[p] = 0;
  for (int i = start[p]; i != 0; i = e[i].next)
    if (!u[e[i].num]) {
      dfs(e[i].num);
      size[p] += size[e[i].num];
      maxch[p] = max(maxch[p], size[e[i].num]);
    }
}
int dis[MAXN], v[MAXN], a[MAXN], b[MAXN];
int pa[MAXN], pb[MAXN];
void dfs2(int p, int fa, int mid, int *a, int *pa) {
  for (int i = start[p]; i != 0; i = e[i].next)
    if (e[i].num != fa) {
      dis[e[i].num] = dis[p] + 1;
      v[e[i].num] = v[p];
      if (e[i].w >= mid)
        v[e[i].num]++;
      else
        v[e[i].num]--;
      dfs2(e[i].num, p, mid, a, pa);
    }
  if (v[p] > a[dis[p]]) a[dis[p]] = v[p], pa[dis[p]] = p;
}
int q[MAXN];
bool chk(int mid, int p) {
  int s = (top - 1) / 2;
  int nt, last, st = start[p];
  for (int i = start[p]; i != 0; i = e[i].next) {
    s -= size[e[i].num];
    if (s <= 0) {
      nt = e[i].next;
      last = i;
      e[i].next = 0;
      break;
    }
  }
  for (int i = 0; i <= top; i++) a[i] = b[i] = -1000000;
  dis[p] = 0;
  v[p] = 0;
  dfs2(p, -1, mid, b, pb);
  start[p] = nt;
  e[last].next = nt;
  dfs2(p, -1, mid, a, pa);
  start[p] = st;
  int l = 1, r = 0;
  int now1 = -1;
  for (int i = top; i >= 0; i--) {
    while (now1 != top && now1 + 1 + i <= R) {
      q[++r] = ++now1;
      while (l < r && a[q[r]] >= a[q[r - 1]]) r--, q[r] = q[r + 1];
    }
    while (l <= r && q[l] + i < L) l++;
    if (l <= r && a[q[l]] + b[i] >= 0) {
      if (mid > ans) {
        ans = mid;
        ans_start = pa[q[l]];
        ans_end = pb[i];
      }
      return true;
    }
  }
  return false;
}
void work(int p) {
  Clr();
  dfs(p);
  if (top == 1) return;
  if (top == 2) {
    if (L == 1 && e[start[p]].w > ans) {
      ans = e[start[p]].w;
      ans_start = p;
      ans_end = e[start[p]].num;
    }
    return;
  }
  for (int i = 1; i <= top; i++)
    maxch[stk[i]] = max(maxch[stk[i]], top - size[stk[i]]);
  int k = p;
  for (int i = 1; i <= top; i++)
    if (maxch[stk[i]] < maxch[k]) k = stk[i];
  p = k;
  Clr();
  dfs(p);
  int l = -1, r = 1000000000;
  while (l < r) {
    int mid = (l + r + 1) >> 1;
    if (chk(mid, p))
      l = mid;
    else
      r = mid - 1;
    if (r < ans) break;
  }
  int s = (top - 1) / 2;
  int nt, last, st = start[p];
  for (int i = start[p]; i != 0; i = e[i].next) {
    s -= size[e[i].num];
    if (s <= 0) {
      nt = e[i].next;
      last = i;
      e[i].next = 0;
      break;
    }
  }
  work(p);
  start[p] = nt;
  e[last].next = nt;
  work(p);
  start[p] = st;
}
int main() {
  scanf("%d", &n);
  scanf("%d%d", &L, &R);
  for (int i = 1; i < n; i++) {
    int p, q, r;
    scanf("%d%d%d", &p, &q, &r);
    Add_edge(p, q, r);
  }
  work(1);
  printf("%d %d\n", ans_start, ans_end);
  return 0;
}
