#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
int a[60][60], b[60][60];
void die(int v)
{
    puts(v ? "Possible" : "Impossible");
    exit(0);
}
int main()
{
    int n, m;
    scanf("%d%d", &n, &m);
    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= m; j++)
            scanf("%d", &a[i][j]);
    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= m; j++)
            scanf("%d", &b[i][j]);
    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= m; j++)
            if (a[i][j] > b[i][j])
                swap(a[i][j], b[i][j]);
    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= m; j++)
            if (a[i - 1][j] >= a[i][j] || a[i][j - 1] >= a[i][j] ||
                b[i - 1][j] >= b[i][j] || b[i][j - 1] >= b[i][j])
                die(0);
    die(1);
    return 0;
}
