#include <bits/stdc++.h>
struct MI {
 private:
  char bb[1 << 14];
  FILE *f;
  char *bs, *be;
  char e;
  bool o, l;

 public:
  MI() : f(stdin), bs(0), be(0) {}
  inline char get() {
    if (o) {
      o = 0;
      return e;
    }
    if (bs == be) be = (bs = bb) + fread(bb, 1, sizeof(bb), f);
    if (bs == be) {
      l = 1;
      return -1;
    };
    return *bs++;
  }
  inline void unget(char c) {
    o = 1;
    e = c;
  }
  template <class T>
  inline T read() {
    T r;
    *this > r;
    return r;
  }
  template <class T>
  inline MI &operator>(T &);
};
template <class T>
struct Q {
  const static bool U = T(-1) >= T(0);
  inline void operator()(MI &t, T &r) const {
    r = 0;
    char c;
    bool y = 0;
    if (U)
      for (;;) {
        c = t.get();
        if (c == -1) goto E;
        if (isdigit(c)) break;
      }
    else
      for (;;) {
        c = t.get();
        if (c == -1) goto E;
        if (c == '-') {
          c = t.get();
          if (isdigit(c)) {
            y = 1;
            break;
          };
        } else if (isdigit(c))
          break;
        ;
      };
    for (;;) {
      if (c == -1) goto E;
      if (isdigit(c))
        r = r * 10 + (c ^ 48);
      else
        break;
      c = t.get();
    }
    t.unget(c);
  E:;
    if (y) r = -r;
  }
};
template <>
struct Q<char> {};
template <class T>
inline MI &MI::operator>(T &t) {
  Q<T>()(*this, t);
  return *this;
}
template <class T>
std::ostream &operator<(std::ostream &out, const T &t) {
  return out << t;
}
using std::cout;
MI cin;
const int $n = 100005;
int n, m, v[$n];
long long dis[$n];
std::vector<int> outs[$n];
struct range {
  long long l, r;
  range(long long l, long long r) : l(l), r(r) {}
  inline bool operator<(const range &t) const { return r < t.r; }
};
std::vector<range> all;
namespace lct {
int fa[$n], son[$n][2];
long long lst[$n], tag[$n];
inline bool nro(int x) { return son[fa[x]][0] == x || son[fa[x]][1] == x; }
inline bool sid(int x) { return son[fa[x]][1] == x; }
inline void upd(int x, long long t) {
  if (x) tag[x] = lst[x] = t;
}
inline void pd(int x) {
  if (!tag[x]) return;
  upd(son[x][0], tag[x]);
  upd(son[x][1], tag[x]);
  tag[x] = 0;
}
inline void rot(int x) {
  const auto y = fa[x], z = fa[y], d = (int)sid(x);
  int &w = son[x][!d];
  if (nro(y)) son[z][sid(y)] = x;
  fa[x] = z;
  son[y][d] = w;
  fa[w] = y;
  w = y;
  fa[y] = x;
}
inline void spl(int x) {
  static int s[$n];
  int y = s[s[0] = 1] = x;
  while (nro(y)) s[++s[0]] = y = fa[y];
  while (s[0]) pd(s[s[0]--]);
  while (nro(x)) {
    if (nro(y = fa[x])) rot(sid(x) == sid(y) ? y : x);
    rot(x);
  }
}
inline void acc(int x, long long t) {
  const auto o = x;
  int r = 0;
  for (int r = 0; x; x = fa[r = x]) {
    spl(x);
    if (r) son[x][1] = r, all.emplace_back(lst[x] + dis[x] + 1, t + dis[x]);
  }
  spl(o);
  upd(son[o][0], t);
}
}  // namespace lct
void dfs(int x) {
  lct::lst[x] = LLONG_MIN;
  for (int v : outs[x]) {
    lct::fa[v] = x;
    lct::son[x][1] = v;
    dis[v] = dis[x] + ::v[v];
    dfs(v);
  }
}
int main() {
  cin > n > m;
  for (auto __r = (n - 1), _ = ((decltype(n - 1))1); _ <= __r; ++_)
    if (const auto x = (cin.read<int>()), y = (cin.read<int>()); 1)
      outs[x].push_back(y), cin > v[y];
  dfs(1);
  for (auto __r = (m), _ = ((decltype(m))1); _ <= __r; ++_)
    if (const auto s = (cin.read<int>()), t = (cin.read<int>()); 1)
      lct::acc(s, t);
  std::set<range> w;
  w.emplace(1, LLONG_MAX);
  std::sort(all.begin(), all.end());
  int hao = 0, c = 0;
  long long shang = -1;
  for (auto [l, r] : all) {
    if (r != shang) {
      hao = c;
      shang = r;
    }
    auto it = w.lower_bound({0, l});
    if (it == w.end() || it->l > r) return cout < r < ' ' < hao < ('\n'), 0;
    ++c;
    auto [tl, tr] = *it;
    w.erase(it);
    const auto p = std::max(l, tl);
    if (tl != p) w.emplace(tl, p - 1);
    if (p != tr) w.emplace(p + 1, tr);
  }
  cout < "-1 " < c < ('\n');
}
