#include <bits/stdc++.h>
using namespace std;
int mat1[51][51];
int mat2[51][51];
bool check(int n1, int n2, int n3, int n4) {
  int mn = min(min(n1, n2), min(n3, n4));
  int mx = max(max(n1, n2), max(n3, n4));
  if (n1 == mx || n2 == mx) {
    return false;
  }
  if (n3 == mn || n4 == mn) {
    return false;
  }
  return true;
}
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      scanf("%d", &mat1[i][j]);
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      scanf("%d", &mat2[i][j]);
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m - 1; j++) {
      if (!check(mat1[i][j], mat2[i][j], mat1[i][j + 1], mat2[i][j + 1])) {
        printf("Impossible");
        return 0;
      }
    }
  }
  for (int i = 0; i < n - 1; i++) {
    for (int j = 0; j < m; j++) {
      if (!check(mat1[i][j], mat2[i][j], mat1[i + 1][j], mat2[i + 1][j])) {
        printf("Impossible");
        return 0;
      }
    }
  }
  printf("Possible");
  return 0;
}
