import java.io.*; import java.util.*; public class MaartenScanner { public static void main(String[] args) throws IOException { try (BufferedReader reader = new BufferedReader(new InputStreamReader(System.in))) { new MaartenScanner().run(new Scanner(reader)); } } public void run(Scanner sc) throws IOException { int n = sc.nextInt(), r = sc.nextInt(); // `students` is transposed relative from the input: we have one row per student, instead of one row per topic boolean[][] students = new boolean[2 * n][r]; for (int i = 0; i < r; i++) { for (int j = 0; j < 2 * n; j++) { students[j][i] = sc.nextInt() > n; } } List studentStrs = new ArrayList<>(2 * n); List invertedStrs = new ArrayList<>(2 * n); for (int i = 0; i < 2 * n; i++) { StringBuilder sb1 = new StringBuilder(r), sb2 = new StringBuilder(r); for (int j = 0; j < r; j++) { sb1.append(students[i][j] ? "1" : "0"); sb2.append(students[i][j] ? "0" : "1"); } studentStrs.add(sb1.toString()); invertedStrs.add(sb2.toString()); } Collections.sort(studentStrs); Collections.sort(invertedStrs); for (int i = 0; i < 2 * n; i++) { if (!studentStrs.get(i).equals(invertedStrs.get(i))) { System.out.println("impossible"); return; } } System.out.println("possible"); } }