#include #define rep(i,n) for(int i=0;i<(int)(n);i++) #define rrep(i,n) for(int i=(int)(n-1);i>=0;i--) #define FOR(i,n,m) for(int i=n;i<=(int)(m);i++) #define RFOR(i,n,m) for(int i=(int)(n);i>=m;i--) #define all(x) (x).begin(),(x).end() #define sz(x) int(x.size()) typedef long long ll; const int INF = 1e9; const int MOD = 1e9+7; const ll LINF = 1e18; const double PI=3.14159265358979323846; using namespace std; vector dy={1,0,-1,0}; vector dx={0,1,0,-1}; template vector make_vec(size_t a){ return vector(a); } template auto make_vec(size_t a, Ts... ts){ return vector(ts...))>(a, make_vec(ts...)); } int main() { int n,m,k; cin>>n>>m>>k; auto a=make_vec (n,m); rep(i,n) rep(j,m) cin>>a[i][j]; auto dp=make_vec (n+1,k+10); dp[0][0]=true; rep(i,n) { rep(j,k+1) { if(!dp[i][j]) continue; rep(x,m) dp[i+1][min(k+1,j+a[i][x])]=true; } } rrep(i,k+1) { if(dp[n][i]) { cout<