Identify the time complexity of the following code as constant, linear, quadratic, cubic, log(n), nlog(n) or NP-hard. import java.util.*;
import java.io.*;
import java.math.*;

/**
 *
 * @Har_Har_Mahadev
 */

public class D {

	private static long INF = 2000000000000000000L, M = 1000000007, MM = 998244353;
	private static int N = 0;
	private static long[][][] dp;
	private static long[][] ff;
	private static long[][] ss;

	public static void process() throws IOException {

		int n = sc.nextInt(),m = sc.nextInt(),k = sc.nextInt();
		
		ff = new long[n][m];
		ss = new long[n][m];
		for(int i = 0; i<n; i++) {
			for(int j = 0; j<m-1; j++) {
				ff[i][j] = sc.nextLong();
			}
		}
		for(int i = 0; i<n-1; i++) {
			for(int j = 0; j<m; j++) {
				ss[i][j] = sc.nextLong();
			}
		}
		
		if(k%2 == 1) {
			for(int i = 0; i<n; i++) {
				for(int j = 0; j<m; j++)System.out.print(-1+" ");
				System.out.println();
			}
			return;
		}
		
		dp = new long[n+1][m+1][11];
		for(int i = 0; i<=n; i++) {
			for(int j = 0; j<=m; j++)Arrays.fill(dp[i][j], -1);
		}
		for(int i = 0; i<=n; i++) {
			for(int j = 0; j<=m; j++) {
				dp[i][j][0] = 0;
			}
		}
		
		k/=2;
		long ans[][] = new long[n][m];
		for(int i = 0; i<n; i++) {
			for(int j = 0; j<m; j++) {
				ans[i][j] = solve(i,j,k,n,m)*2L;
			}
		}
		for(int i = 0; i<n; i++) {
			for(int j = 0; j<m; j++)print(ans[i][j]+" ");
			println();
		}
	}

	private static long solve(int i, int j, int k, int n, int m) {
		if(dp[i][j][k] != -1)return dp[i][j][k];
		long ans = Long.MAX_VALUE;
		if(i+1<n) {
			ans = min(ans,ss[i][j] + solve(i+1, j, k-1, n, m));
		}
		if(i-1>=0) {
			ans = min(ans,ss[i-1][j] + solve(i-1, j, k-1, n, m));
		}
		if(j+1<m) {
			ans = min(ans,ff[i][j] + solve(i, j+1, k-1, n, m));
		}
		if(j-1>=0) {
			ans = min(ans,ff[i][j-1] + solve(i, j-1, k-1, n, m));
		}
		
		return dp[i][j][k] = ans;
	}

	//=============================================================================
	//--------------------------The End---------------------------------
	//=============================================================================

	static FastScanner sc;
	static PrintWriter out;

	public... Complexity: