#include <bits/stdc++.h>
using namespace std;
int n, s, e, A[100010], ans[100010];
long long m = 100000000000;
struct data {
  int x, y;
  bool operator<(const data &r) const { return r.x < x; }
} B[100010];
int main() {
  scanf("%d %d %d", &n, &s, &e);
  for (int i = 0; i < n; i++) scanf("%d", &A[i]);
  for (int i = 0; i < n; i++) {
    scanf("%d", &B[i].x);
    B[i].y = i;
  }
  sort(B, B + n);
  for (int i = 0; i < n; i++) {
    int j = B[i].y;
    if (i != 0 && B[i].x == B[i - 1].x) {
      if (s - A[j] <= m) {
        m = min(m, (long long)e - A[j]);
        ans[j] = m + A[j];
        continue;
      }
      printf("-1");
      return 0;
    } else {
      if (s - A[j] < m) {
        m = min(m - 1, (long long)e - A[j]);
        ans[j] = m + A[j];
        continue;
      }
      printf("-1");
      return 0;
    }
  }
  for (int i = 0; i < n; i++) printf("%d ", ans[i]);
}
