#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
struct trio {
  int x, y, z;
  friend bool operator<(const trio& a, const trio& b) {
    if (a.x == b.x) return a.z > b.z;
    return a.x < b.x;
  }
};
int main() {
  int n, a[N], b[N], l, r;
  map<int, int> mp;
  trio p[N];
  scanf("%d%d%d", &n, &l, &r);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  for (int i = 0; i < n; i++) scanf("%d", &p[i].x), p[i].y = i, p[i].z = a[i];
  sort(p, p + n);
  int o = r, prev = r - p[n - 1].z;
  b[p[n - 1].y] = o;
  for (int i = n - 2; i >= 0; i--) {
    int cur = prev + p[i].z - 1;
    if (cur > r) {
      prev -= (cur - r);
      cur = r;
    }
    if (p[i + 1].x == p[i].x || cur < l) {
      puts("-1");
      return 0;
    }
    b[p[i].y] = cur;
    prev--;
  }
  for (int i = 0; i < n; i++) printf("%d ", b[i]);
  return 0;
}
