#include <bits/stdc++.h>
#pragma GCC optimize("O2")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx,avx2,sse,sse2,fma")
using namespace std;
const int N = 1e5 + 10;
struct node {
  int a, b, c;
};
node E[N];
int L, R, n, hide[N], sub[N], H[N], dis[N], M;
vector<pair<int, int> > adj[N];
pair<int, int> seg[N << 1], Ans, inf = make_pair(-1e9, -1e9);
inline void add_edge(int a, int b, int c) {
  adj[a].push_back(make_pair(b, c));
  adj[b].push_back(make_pair(a, c));
}
void dfs(int v, int P) {
  sub[v] = 1;
  for (auto y : adj[v]) {
    int u = y.first;
    if (hide[u] || u == P) continue;
    dfs(u, v);
    sub[v] += sub[u];
  }
}
int find(int v, int P, int _n) {
  for (auto y : adj[v]) {
    if (hide[y.first] || y.first == P) continue;
    if (sub[y.first] * 2 > _n) {
      return find(y.first, v, _n);
    }
  }
  return v;
}
inline void prep() {
  for (int i = 0; i < (M << 1); i++) {
    seg[i] = inf;
  }
}
inline pair<int, int> G(int l, int r) {
  r = min(r, M - 1);
  l += M, r += M;
  pair<int, int> ret = inf;
  while (l < r) {
    if (l & 1) ret = max(ret, seg[l++]);
    if (r & 1) ret = max(ret, seg[--r]);
    l >>= 1, r >>= 1;
  }
  return ret;
}
inline void U(int p, pair<int, int> x) {
  p += M;
  while (p) {
    seg[p] = max(seg[p], x);
    p >>= 1;
  }
}
void dfs1(int v, int P) {
  pair<int, int> cur = G(max(0, L - H[v]), max(0, R - H[v] + 1));
  if (cur.first + dis[v] >= 0) Ans = make_pair(v, cur.second);
  for (auto y : adj[v]) {
    if (hide[y.first] || y.first == P) continue;
    dis[y.first] = dis[v] + y.second;
    H[y.first] = H[v] + 1;
    dfs1(y.first, v);
  }
}
void dfs2(int v, int P) {
  U(H[v], make_pair(dis[v], v));
  for (auto y : adj[v]) {
    if (hide[y.first] || y.first == P) continue;
    dfs2(y.first, v);
  }
}
void dec(int v) {
  if (Ans != inf) return;
  dfs(v, 0);
  int _n = sub[v], centroid = find(v, 0, _n);
  M = _n + 3;
  prep();
  U(0, make_pair(0, centroid));
  hide[centroid] = 1;
  for (auto y : adj[centroid]) {
    if (hide[y.first]) continue;
    H[y.first] = 1, dis[y.first] = y.second;
    dfs1(y.first, 0), dfs2(y.first, 0);
  }
  for (auto y : adj[centroid]) {
    if (hide[y.first]) continue;
    dec(y.first);
  }
}
bool check(int x) {
  memset(hide, 0, sizeof hide);
  Ans = inf;
  for (int i = 0; i <= n + 1; i++) {
    adj[i].clear();
  }
  for (int i = 1; i < n; i++) {
    if (E[i].c >= x) {
      add_edge(E[i].a, E[i].b, 1);
    } else {
      add_edge(E[i].a, E[i].b, -1);
    }
  }
  dec(1);
  if (Ans == inf) return 0;
  return 1;
}
int main() {
  vector<int> cm;
  cm.push_back(2e9);
  scanf("%d%d%d", &n, &L, &R);
  for (int i = 1; i < n; i++) {
    scanf("%d%d%d", &E[i].a, &E[i].b, &E[i].c);
    cm.push_back(E[i].c);
  }
  sort((cm).begin(), (cm).end());
  cm.resize(unique((cm).begin(), (cm).end()) - cm.begin());
  Ans = inf;
  int d = 0, up = (int)cm.size();
  while (up - d > 1) {
    int mid = (up + d) >> 1;
    if (check(cm[mid])) {
      d = mid;
    } else {
      up = mid;
    }
  }
  check(cm[d]);
  printf("%d %d\n", Ans.first, Ans.second);
  return 0;
}
