#include <bits/stdc++.h>
using namespace std;
const int N = 2222;
bitset<N> a[2][N];
int x, y, m[2], ok[N], n;
int transform(int x) { return (x > 0) ? ((x - 1) * 2) : ((-x - 1) * 2 + 1); }
void build_it(int m, bitset<N>* a) {
  for (int i = 0; i < m; ++i) {
    scanf("%d%d", &x, &y);
    x = transform(x), y = transform(y);
    a[x ^ 1].set(y);
    a[y ^ 1].set(x);
  }
  for (int i = 0; i < 2 * n; ++i) a[i].set(i);
  for (int k = 0; k < 2 * n; ++k)
    for (int i = 0; i < 2 * n; ++i)
      if (a[i][k]) a[i] |= a[k];
  for (int i = 0; i < 2 * n; ++i)
    if (a[i][i ^ 1]) {
      for (int j = 0; j < 2 * n; ++j) {
        a[i].set(j);
        a[j].set(i ^ 1);
      }
    }
  for (int k = 0; k < 2 * n; ++k)
    for (int i = 0; i < 2 * n; ++i)
      if (a[i][k]) a[i] |= a[k];
}
void markiza(bitset<N>* a, int x) {
  if (ok[x] != -1) return;
  ok[x] = 1, ok[x ^ 1] = 0;
  for (int i = 0; i < 2 * n; ++i)
    if (a[x][i]) markiza(a, i);
}
void restore(bitset<N>* a, int xtrue, int xfalse) {
  markiza(a, xtrue);
  markiza(a, xfalse ^ 1);
  for (int i = 0; i < 2 * n; ++i)
    if ((ok[i] == -1) && !a[i][i ^ 1]) {
      markiza(a, i);
    }
}
int main() {
  scanf("%d%d%d", &n, &m[0], &m[1]);
  for (int j = 0; j < 2; ++j) build_it(m[j], a[j]);
  for (int i = 0; i < 2 * n; ++i) ok[i] = -1;
  for (int i = 0; i < 2 * n; ++i)
    for (int j = 0; j < 2 * n; ++j)
      if (a[0][i][j] != a[1][i][j]) {
        restore(a[a[1][i][j] ? 0 : 1], i, j);
        for (int k = 0; k < n; ++k)
          printf("%d%c", ok[2 * k], " \n"[k == n - 1]);
        return 0;
      }
  printf("SIMILAR\n");
  return 0;
}
