/******************************************************************************
Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press “Run” button to compile and execute it.
*******************************************************************************/
#include
#include
using namespace std;
void waveform(int a[][10],int m, int n){
int i;
for (int i=0; i<m; i++){
if (i%2!=0){
for (int j=0; j<n; j++){
cout<<a[i][j]<<",";
}
}
else{
for(int j=n-1;j>=0;j–){
cout<<a[i][j]<<",";
}
}
}
}
int main(){
int m;
int n;
cin>>m>>n;
int a[][10]
for(int i=0;i<m;i++){
for(int j=0;j<m;j++){
cin>>a[i][j];
}
}
waveform(a,m,n);
return 0;
}