#include<iostream>
using namespace std;
#include<string>
#include<vector>
class Solution
{
private:
vector<vector<int >> result;
vector<int > path;
void backtracking(int n,int k,int startIndex)
{
if(path.size()==k)
{
result.push_back(path);
return ;

}
for(int i=startIndex;i<=n;i++)
{

path.push_back(i);
backtracking(n,k,i+1);
path.pop_back();

}

}
public :
vector<vector<int >> combine(int n,int k)
{
result.clear();
path.clear();
backtracking(n,k,1);
return result;

}



};

int main()
{

Solution solue;
vector<vector<int >> res=solue.combine(4,2);
for(int i=0;i<res.size();i++)
{
for(int j=0;j<res[i].size();j++)
{
cout<<res[i][j]<<" ";
}
cout<<endl;
}



return 0;

}