#include <bits/stdc++.h>
int N, M1, M2;
inline int inv(int x) { return x <= N ? x + N : x - N; }
struct graph {
  std::bitset<2001> G[2001];
  bool no_solution;
  int f[2001];
  void Start(int p) {
    if (~f[p]) return;
    f[p] = 1;
    f[inv(p)] = 0;
    for (int i = 1; i <= N + N; i++)
      if (G[p][i]) Start(i);
  }
  void floyd() {
    for (int i = 1; i <= N + N; i++) G[i].set(i);
    for (int i = 1; i <= N + N; i++)
      for (int j = 1; j <= N + N; j++)
        if (G[j][i]) G[j] |= G[i];
    for (int i = 1; i <= N; i++)
      if (G[i][i + N] && G[i + N][i]) {
        no_solution = true;
        return;
      }
    for (int i = 1; i <= N + N; i++) f[i] = -1;
    for (int i = 1; i <= N; i++)
      if (G[i][i + N]) Start(i + N);
    for (int i = 1; i <= N; i++)
      if (G[i + N][i]) Start(i);
  }
  void print() {
    for (int i = 1; i <= N + N; i++)
      if (!~f[i]) Start(i);
    for (int i = 1; i <= N; i++) printf("%d%c", f[i], " \n"[i == N]);
    exit(0);
  }
} G1, G2;
void Solve(graph &A, graph &B) {
  if (A.no_solution) return;
  if (B.no_solution) A.print();
  for (int i = 1; i <= N + N; i++)
    if (A.f[i] && !B.f[i]) {
      A.Start(i);
      A.print();
    }
  for (int i = 1; i <= N + N; i++)
    for (int j = 1; j <= N + N; j++)
      if (!~A.f[i] && !~A.f[j] && !A.G[i][j] && B.G[i][j]) {
        A.Start(i);
        A.Start(inv(j));
        A.print();
      }
}
int main() {
  scanf("%d%d%d", &N, &M1, &M2);
  for (int i = 1, x, y; i <= M1; i++) {
    scanf("%d%d", &x, &y);
    if (x < 0) x = N - x;
    if (y < 0) y = N - y;
    G1.G[inv(x)].set(y);
    G1.G[inv(y)].set(x);
  }
  for (int i = 1, x, y; i <= M2; i++) {
    scanf("%d%d", &x, &y);
    if (x < 0) x = N - x;
    if (y < 0) y = N - y;
    G2.G[inv(x)].set(y);
    G2.G[inv(y)].set(x);
  }
  G1.floyd();
  G2.floyd();
  Solve(G1, G2);
  Solve(G2, G1);
  puts("SIMILAR");
  return 0;
}
