#include <bits/stdc++.h>
using namespace std;
int a[100009], b[100009], i, n, curmac, cur, l, d, fv[100009], first, mac;
int main() {
  cin >> n >> l >> d;
  for (i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (i = 1; i <= n; i++) {
    cin >> first;
    fv[first] = i;
  }
  b[fv[n]] = d;
  mac = d - a[fv[n]];
  for (i = n - 1; i >= 1; i--) {
    cur = mac + a[fv[i]] - 1;
    if (cur < l) {
      cout << -1;
      return 0;
    }
    cur = min(cur, d);
    b[fv[i]] = cur;
    mac = cur - a[fv[i]];
  }
  for (i = 1; i <= n; i++) {
    cout << b[i] << ' ';
  }
  return 0;
}
