#include <bits/stdc++.h>
using namespace std;
const int inf = -1e9 - 7;
const int maxn = 110000;
int n, l, r;
vector<pair<int, int> > adj[maxn];
vector<int> cen;
vector<int> nums;
int sub[maxn];
int mark[maxn];
int SZ = 1;
int seg[maxn * 5];
int dp[maxn];
int mh;
int V;
int vdp[maxn];
int lg = 1;
int sz[maxn];
void clr(int L = 0, int R = SZ, int id = 1) {
  if (seg[id] == inf) return;
  seg[id] = inf;
  if (L == R - 1) return;
  int mid = (L + R) >> 1;
  clr(L, mid, id << 1);
  clr(mid, R, (id << 1) | 1);
}
void dfss(int root, int par) {
  sub[root] = 1;
  for (auto x : adj[root])
    if (!mark[x.first] and x.first != par) {
      dfss(x.first, root);
      sub[root] += sub[x.first];
    }
}
queue<int> inds;
inline void cnf(int v, int par) {
  inds.push(v);
  while (inds.size()) {
    v = inds.front();
    inds.pop();
    dfss(v, -1);
    int k = sub[v] >> 1;
    int dad = -1;
    int med = v;
    while (1) {
      bool found = 0;
      for (auto e : adj[med]) {
        int x = e.first;
        if (!mark[x] and sub[x] >= k and x != dad) {
          dad = med;
          med = x;
          found = 1;
          break;
        }
      }
      if (!found) break;
    }
    cen.push_back(med);
    mark[med] = 1;
    sz[med] = sub[v];
    for (auto e : adj[med])
      if (!mark[e.first]) inds.push(e.first);
  }
}
int fnd(int l, int r, int id = 1, int L = 0, int R = SZ) {
  if (R <= l or r <= L) return inf;
  if (l <= L and R <= r) return seg[id];
  int mid = (L + R) >> 1;
  return max(fnd(l, r, id << 1, L, mid), fnd(l, r, (id << 1) | 1, mid, R));
}
void inline add(int id, int x) {
  id += SZ;
  while (id) {
    seg[id] = max(seg[id], x);
    id >>= 1;
  }
}
void dfs(int root, int dad, int t, int h, int mid) {
  bool ret = 0;
  if (h > mh) {
    dp[h] = inf;
    mh = h;
  }
  if (dp[h] < t) {
    vdp[h] = root;
    dp[h] = t;
  }
  for (auto e : adj[root]) {
    if (lg != mark[e.first] and e.first != dad) {
      int T = e.second;
      if (T >= mid)
        T = +1;
      else
        T = -1;
      dfs(e.first, root, t + T, h + 1, mid);
    }
  }
}
inline bool check(int mid) {
  for (auto med : cen) {
    if (sz[med] < l) continue;
    mark[med] = lg;
    clr();
    add(0, 0);
    for (auto e : adj[med]) {
      mh = 0;
      if (mark[e.first] == lg) continue;
      int t = e.second;
      if (t >= mid)
        t = +1;
      else
        t = -1;
      dfs(e.first, med, t, 1, mid);
      for (int j = 1; j < mh + 1; j++) {
        int lf = l - j;
        int rf = r - j + 1;
        int k = fnd(lf, rf);
        if (k + dp[j] >= 0) {
          V = vdp[j];
          return 1;
        }
      }
      for (int j = 1; j < mh + 1; j++)
        if (dp[j] > seg[j + SZ]) add(j, dp[j]);
    }
  }
  return 0;
}
void fff(int root, int par, int st, int h = 0, int t = 0) {
  if (l <= h and h <= r and t >= 0) {
    printf(" %d", root + 1);
    exit(0);
  }
  for (auto e : adj[root]) {
    if (e.first != par) {
      int T = e.second;
      if (T >= st)
        T = +1;
      else
        T = -1;
      fff(e.first, root, st, h + 1, t + T);
    }
  }
}
inline bool cmp(int x, int y) { return sz[x] > sz[y]; }
int main() {
  scanf("%d%d%d", &n, &l, &r);
  for (int i = 1; i < n; i++) {
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);
    a--, b--;
    nums.push_back(c);
    adj[a].push_back(make_pair(b, c));
    adj[b].push_back(make_pair(a, c));
  }
  sort(nums.begin(), nums.end());
  unique(nums.begin(), nums.end());
  cnf(0, -1);
  while (SZ < n) SZ <<= 1;
  int st = 0;
  int en = nums.size();
  while (st != en - 1) {
    lg++;
    int ind = (st + en) / 2;
    if (check(nums[ind]))
      st = ind;
    else
      en = ind;
  }
  printf("%d", V + 1);
  fff(V, -1, nums[st]);
}
