#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "node.h"



int lists_equal(struct node *a, struct node *b) {
    // TODO: implement this function
    return 0;
}


int main(void) {
    int na;
    if (scanf("%d", &na) != 1) { na = 0; }
    int a_arr[1000];
    for (int i = 0; i < na; i++) { scanf("%d", &a_arr[i]); }
    int nb;
    if (scanf("%d", &nb) != 1) { nb = 0; }
    int b_arr[1000];
    for (int i = 0; i < nb; i++) { scanf("%d", &b_arr[i]); }
    struct node *a = build_list(a_arr, na);
    struct node *b = build_list(b_arr, nb);
    printf("%d\n", lists_equal(a, b));
    free_list(a);
    free_list(b);
    return 0;
}
