#include <stdio.h>

int main() {
    int rows, cols;
    printf("Enter number of rows: ");
    scanf("%d", &rows);
    printf("Enter number of columns: ");
    scanf("%d", &cols);
    int arr[rows][cols];
    printf("Enter array elements:\n");
    for(int i = 0; i < rows; i++) {
        for(int j = 0; j < cols; j++) {
            scanf("%d", &arr[i][j]);
        }
    }
    printf("\nEven numbers:\n");
    for(int i = 0; i < rows; i++) {
        for(int j = 0; j < cols; j++) {
            if(arr[i][j] % 2 == 0)
                printf("%d ", arr[i][j]);
        }
    }
    printf("\n\nOdd numbers:\n");
    for(int i = 0; i < rows; i++) {
        for(int j = 0; j < cols; j++) {
           if(arr[i][j] %  2 !== 0){
                printf("%d ", arr[i][j]);
        }
    }
    return 0;
}