#108Easy
Swap two rows
Time: 1 s · Memory: 256 MB
- Matrices
Statement
You are given an matrix and two numbers , . Swap rows and of the matrix.
Input format
The first line contains , , , (, ). The next lines contain the matrix (). Rows are numbered from ; is possible.
Output format
The changed matrix: lines with numbers each.
Examples
Input
3 3 1 3 1 2 3 4 5 6 7 8 9
Output
7 8 9 4 5 6 1 2 3
Input
2 2 2 2 1 1 2 2
Output
1 1 2 2
Note
Rows are numbered from while array indices start at — swap and . In C++ swap(a[k1 - 1], a[k2 - 1]) swaps whole rows at once.
