#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
int rd() {
  int x = 0, w = 1;
  char ch = 0;
  while (ch < '0' || ch > '9') {
    if (ch == '-') w = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + (ch ^ 48);
    ch = getchar();
  }
  return x * w;
}
struct tss {
  int x, y;
  bool operator<(const tss &bb) const {
    return y != bb.y ? y > bb.y : x < bb.x;
  }
} a[N];
int n, m, an[N], ch[N][2], sz[N], rt, va[N], ta[N], tb[N];
void ad1(int x, int y) {
  if (x) an[x] += y, ta[x] += y;
}
void ad2(int x, int y) {
  if (x) va[x] += y, tb[x] += y;
}
void psdn(int x) {
  if (ta[x]) ad1(ch[x][0], ta[x]), ad1(ch[x][1], ta[x]), ta[x] = 0;
  if (tb[x]) ad2(ch[x][0], tb[x]), ad2(ch[x][1], tb[x]), tb[x] = 0;
}
void psup(int x) { sz[x] = sz[ch[x][0]] + sz[ch[x][1]] + 1; }
int sx, tx, zx;
void spli(int x, int y, int &x1, int &x2) {
  if (!x) {
    x1 = x2 = 0;
    return;
  }
  psdn(x);
  if (va[x] <= y)
    x1 = x, spli(ch[x1][1], y, ch[x1][1], x2), psup(x1);
  else
    x2 = x, spli(ch[x2][0], y, x1, ch[x2][0]), psup(x2);
}
int merg(int x1, int x2) {
  if (!x1 || !x2) return x1 + x2;
  psdn(x1), psdn(x2);
  if (1ll * rand() * (sz[x1] + sz[x2]) <= 1ll * sz[x1] * RAND_MAX) {
    ch[x1][1] = merg(ch[x1][1], x2), psup(x1);
    return x1;
  } else {
    ch[x2][0] = merg(x1, ch[x2][0]), psup(x2);
    return x2;
  }
  return 0;
}
void inst(int &rt, int x) {
  spli(rt, va[x], sx, tx);
  rt = merg(merg(sx, x), tx);
}
void wk(int x) {
  if (!x) return;
  psdn(x);
  int lc = ch[x][0], rc = ch[x][1];
  ch[x][0] = ch[x][1] = 0, sz[x] = 1, inst(sx, x);
  wk(lc), wk(rc);
}
void print(int x) {
  if (!x) return;
  psdn(x), print(ch[x][0]), print(ch[x][1]);
}
int main() {
  n = rd();
  for (int i = 1; i <= n; ++i) a[i].x = rd(), a[i].y = rd();
  sort(a + 1, a + n + 1);
  m = rd();
  for (int i = 1; i <= m; ++i) {
    va[i] = rd(), sz[i] = 1;
    inst(rt, i);
  }
  for (int i = 1; i <= n; ++i) {
    int c = a[i].x;
    spli(rt, c - 1, sx, tx), spli(tx, c + c - 1, tx, zx);
    ad1(tx, 1), ad2(tx, -c), ad1(zx, 1), ad2(zx, -c);
    wk(tx);
    rt = merg(sx, zx);
  }
  print(rt);
  for (int i = 1; i <= m; ++i) printf("%d ", an[i]);
  return 0;
}
