#include <bits/stdc++.h>
using namespace std;
const int MAXN = 3 * 100100;
int n, s[MAXN], t[MAXN], ss[MAXN];
stack<pair<int, int>> st;
vector<tuple<int, int, int>> ans;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", &s[i]), ss[i] = i;
  for (int i = 1; i <= n; ++i) scanf("%d", &t[i]);
  sort(ss + 1, ss + n + 1,
       [](const int& x, const int& y) { return s[x] < s[y]; });
  sort(t + 1, t + n + 1);
  for (int i = 1, d; i <= n; ++i) {
    d = t[i] - s[ss[i]];
    if (d > 0)
      st.emplace(ss[i], d);
    else {
      while (d < 0 && !st.empty()) {
        ans.emplace_back(st.top().first, ss[i], min(-d, st.top().second));
        if (d + st.top().second < 0)
          d += st.top().second, st.pop();
        else
          st.top().second += d, d = 0;
        if (!st.empty() && st.top().second == 0) st.pop();
      }
      if (d != 0) printf("NO\n"), exit(0);
    }
  }
  if (!st.empty()) printf("NO\n"), exit(0);
  printf("YES\n%d\n", ans.size());
  for (const auto& [i, j, d] : ans) printf("%d %d %d\n", i, j, d);
}
