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

std::vector <long long int> happy (int N, int Q, std::vector <int> u, std::vector <int> v, std::vector <int> h, std::vector <int> t, std::vector <int> l, std::vector <int> r) {
    vector<bool> isOpen(N, false);
    vector<vector<int>> adj(N, vector<int>(2));
    for(int i = 0; i < N; i++) {
        adj[i][0] = v[i];
        adj[i][1] = h[i];
    }
    vector<long long int> dists[N][N];
    for(int i = 0; i < N; i++) {
            for(int j = 0; j < N; j++) {
                if(j != i) {
                    int start = i;
                    int finish = j;
                    long long routehap = adj[i][1];
                    for(int k = i; k < j; k++) {
                        routehap = (routehap ^ adj[k][1]);
                    }
                }
            }
    }
    vector<long long int> ret(Q);
    for(int q = 0; q < Q; q++) {
        if(t[q] == 1) {
            isOpen[l[q]] = true;
        }
        else if(t[q] == 2) {
            isOpen[l[q]] = false;
        }
        for(int i = 0; i < N; i++) {
            for(int j = 1; j < N; j++) {
                if(i != j && (isOpen[i] == isOpen[j] == true)) {
                    ret.push_back(dists[i][j]);
                }
            }
        }
    }
    return ret;
}
