import sys sys.setrecursionlimit(1000000000) # # Solution Template for Mundane Square # # Australian Informatics Olympiad 2026 # # This file is provided to assist with reading of input and writing of output # for the problem. You may modify this file however you wish, or # you may choose not to use this file at all. # # N is the grid size and K is the maximum value in a cell. N = 0 K = 0 # R and C contain the target row and column sums. The lists start from 0. R = [] C = [] # Read N, K, and the target row and column sums. N, K = map(int, input().strip().split()) R = list(map(int, input().strip().split())) C = list(map(int, input().strip().split())) # TODO: Determine whether a mundane square exists. Output NO if it does not; # otherwise output YES followed by a valid N by N grid. An example NO output is # shown below. print("NO")