#include <fstream>
#include <vector>
#define x first
#define y second
using namespace std;
const int MAXN = 605;
vector<int> G[MAXN];
int N, M, K, C;
int main() {
ifstream cin("camion.in");
ofstream cout("camion.out");
cin >> N >> M >> K >> C;
for(int i = 1 ; i <= N ; ++ i)
for(int j = 1 ; j <= N ; ++ j)
G[i].push_back(j);
for(int i = 1 ; i <= K ; ++ i) {
pair<int, int> st, fn;
cin >> st.x >> st.y >> fn.x >> fn.y;
for(int x = st.x ; x <= fn.x ; ++ x)
for(int y = st.y ; y <= fn.y ; ++ y)
G[x].erase(G[x].begin() + y);
}
for(int i = 1 ; i <= N ; ++ i)
cout << G[i][C-1] * (G[i][C-1] == 0) << '\n';
return 0;
}