#include <bits/stdc++.h>
using std::cin;
using std::cout;
int lbc[100010], rbc[100010], lax[100010], rax[100010];
int main() {
  int n, i, q, a, b, c, d, l, r, la, ra;
  std::string s, t, x, y;
  cin >> s;
  cin >> t;
  for (i = 1; i <= s.size(); i++) {
    if (s[i - 1] != 'A') {
      lbc[i] = lbc[i - 1] + 1;
      lax[i] = 0;
    } else {
      lbc[i] = lbc[i - 1];
      lax[i] = lax[i - 1] + 1;
    }
  }
  for (i = 1; i <= t.size(); i++) {
    if (t[i - 1] != 'A') {
      rbc[i] = rbc[i - 1] + 1;
      rax[i] = 0;
    } else {
      rbc[i] = rbc[i - 1];
      rax[i] = rax[i - 1] + 1;
    }
  }
  cin >> q;
  for (int qq = 0; qq < q; qq++) {
    cin >> a >> b >> c >> d;
    l = lbc[b] - lbc[a - 1];
    r = rbc[d] - rbc[c - 1];
    la = std::min(lax[b], b - a + 1);
    ra = std::min(rax[d], d - c + 1);
    if ((l == 0) && (r > 0)) {
      if (la <= ra) {
        cout << false;
        continue;
      } else {
        l += 2;
        la -= (la - ra) % 3;
      }
    }
    if (l > r) {
      cout << false;
      continue;
    }
    if ((r - l) % 2 == 1) {
      cout << false;
      continue;
    }
    if (ra > la) {
      cout << false;
      continue;
    }
    if (ra < la) {
      if (((la - ra) % 3 != 0) && (r - l == 0)) {
        cout << false;
        continue;
      }
    }
    cout << true;
  }
  return 0;
}
