#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const int maxn = 0;
int n, m;
int a[55][55], b[55][55];
bool ok(int x, int y) { return x > y; }
void promjena(int x, int y) {
  int temp = a[x][y];
  a[x][y] = b[x][y];
  b[x][y] = temp;
  return;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j) cin >> a[i][j];
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j) cin >> b[i][j];
  for (int i = 1; i < n; ++i) {
    bool oka = ok(a[i][0], a[i - 1][0]);
    bool okb = ok(b[i][0], b[i - 1][0]);
    if (oka and okb) {
      if (a[i][0] > b[i][0] and a[i - 1][0] < b[i - 1][0] and
          ok(a[i][0], b[i - 1][0]) and ok(b[i][0], a[i - 1][0])) {
        promjena(i, 0);
      }
      if (b[i][0] > a[i][0] and b[i - 1][0] < a[i - 1][0] and
          ok(a[i][0], b[i - 1][0]) and ok(b[i][0], a[i - 1][0])) {
        promjena(i, 0);
      }
    } else {
      if (ok(a[i][0], b[i - 1][0]) and ok(b[i][0], a[i - 1][0])) {
        promjena(i, 0);
      } else
        return cout << "Impossible", 0;
    }
  }
  for (int i = 1; i < m; ++i) {
    bool oka = ok(a[0][i], a[0][i - 1]);
    bool okb = ok(b[0][i], b[0][i - 1]);
    if (oka and okb) {
      if (a[0][i] > b[0][i] and a[0][i - 1] < b[0][i - 1] and
          ok(a[0][i], b[0][i - 1]) and ok(b[0][i], a[0][i - 1])) {
        promjena(0, i);
      }
      if (b[0][i] > a[0][i] and a[0][i - 1] > b[0][i - 1] and
          ok(a[0][i], b[0][i - 1]) and ok(b[0][i], a[0][i - 1])) {
        promjena(0, i);
      }
    } else {
      if (ok(a[0][i], b[0][i - 1]) and ok(b[0][i], a[0][i - 1])) {
        promjena(0, i);
      } else
        return cout << "Impossible", 0;
    }
  }
  for (int i = 1; i < n; ++i) {
    for (int j = 1; j < m; ++j) {
      bool okaGore = ok(a[i][j], a[i - 1][j]);
      bool okaLevo = ok(a[i][j], a[i][j - 1]);
      bool okbGore = ok(b[i][j], b[i - 1][j]);
      bool okbLevo = ok(b[i][j], b[i][j - 1]);
      bool oka = okaGore and okaLevo;
      bool okb = okbGore and okbLevo;
      if (oka and okb) {
        if (a[i][j] > b[i][j] and a[i - 1][j] < b[i - 1][j] and
            ok(a[i][j], b[i - 1][j]) and ok(a[i][j], b[i][j - 1]) and
            ok(b[i][j], a[i - 1][j]) and ok(b[i][j], a[i][j - 1])) {
          promjena(i, j);
        }
        if (a[i][j] > b[i][j] and a[i][j - 1] < b[i][j - 1] and
            ok(a[i][j], b[i][j - 1]) and ok(b[i][j], a[i][j - 1]) and
            ok(a[i][j], b[i - 1][j]) and ok(b[i][j], a[i - 1][j])) {
          promjena(i, j);
        }
        if (b[i][j] > a[i][j] and b[i - 1][j] < a[i - 1][j] and
            ok(b[i][j], a[i - 1][j]) and ok(b[i][j], a[i][j - 1]) and
            ok(a[i][j], b[i - 1][j]) and ok(a[i][j], b[i][j - 1])) {
          promjena(i, j);
        }
        if (b[i][j] > a[i][j] and b[i][j - 1] < a[i][j - 1] and
            ok(b[i][j], a[i - 1][j]) and ok(b[i][j], a[i][j - 1]) and
            ok(a[i][j], b[i - 1][j]) and ok(a[i][j], b[i][j - 1])) {
          promjena(i, j);
        }
      } else {
        if (ok(a[i][j], b[i - 1][j]) and ok(a[i][j], b[i][j - 1]) and
            ok(b[i][j], a[i - 1][j]) and ok(b[i][j], a[i][j - 1])) {
          promjena(i, j);
        } else
          return cout << "Impossible", 0;
      }
    }
  }
  cout << "Possible";
  return 0;
}
