Given a integer **n**. We have **n*n** values of a 2-d array, and **n** values of 1-d array. Task is to find the sum of the diagonal values of the 2-d array and the max element of the 1-d array and print them with space in between.

**Input:** First line of input contains a single integer T which denotes the number of test cases. T test cases follows, first line of each test case contains a integer n. Second line consists of n*n spaced integers. Third and last line consists of n spaced integers.

**Output:** Print the sum of the diagonal elements and the maximum number of the 1-d array with spaces in between.

**Constraints:**

1<=T<=100

1<= n <=100

1<=element<=10^{3}

**Example:**

**Input:**

1

3

1 2 3 4 5 6 7 8 9

3 6 9

**Output:**

15 9

Author: saksham0751

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.

sabka_din_aayega | 317 |

maggiiiii | 248 |

thanuvinu94 | 211 |

Savage_19 | 206 |

Anugrah_kumar | 172 |

Bishnu Dev Panda | 803 |

sabka_din_aayega | 628 |

Anugrah_kumar | 562 |

okayboss | 561 |

maggiiiii | 531 |

blackshadows | 5331 |

Ibrahim Nash | 5219 |

akhayrutdinov | 5111 |

mb1973 | 4925 |

Quandray | 4547 |

Login to report an issue on this page.