#include <bits/stdc++.h>
using namespace std;

struct Pt {
    long long x, y;
};
long long cross(Pt a, Pt b, Pt c) {
    return (b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x);
}
bool on_seg(Pt a, Pt b, Pt p) {
    if (cross(a, b, p) != 0) return false;
    return p.x >= min(a.x, b.x) && p.x <= max(a.x, b.x) &&
           p.y >= min(a.y, b.y) && p.y <= max(a.y, b.y);
}

void solve() {
    int n, m;
    if (!(cin >> n >> m)) return;

    vector<Pt> p(n);
    for (int i = 0; i < n; i++) cin >> p[i].x >> p[i].y;

    while (m--) {
        Pt q;
        cin >> q.x >> q.y;

        bool bnd = false;
        int cnt = 0;

        for (int i = 0; i < n; i++) {
            Pt a = p[i];
            Pt b = p[(i + 1) % n];

            if (on_seg(a, b, q)) {
                bnd = true;
                break;
            }
            if (a.y > b.y) swap(a, b);
            if (q.y >= a.y && q.y < b.y && cross(q, a, b) > 0) {
                cnt++;
            }
        }

        if (bnd) cout << "BOUNDARY"<<'\n';
        else if (cnt % 2 == 1) cout << "INSIDE"<<'\n';
        else cout << "OUTSIDE"<<'\n';
    }
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    solve();
    return 0;
}
