#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200005;
typedef pair <int, int> pii;
typedef pair <pii, int> piii;
int n, m, s;
vector <pii> edges [MAXN];
int vis [MAXN];
int dist[MAXN];
vector <int> ded [MAXN];
vector <int> rev_ded[MAXN];
vector <int> df_tree [MAXN];
vector <int> dom_tree [MAXN];
int depth[MAXN];
int pa [MAXN][20];
int mini[MAXN][20];
void go (int node){
    priority_queue <pii, vector<pii>, greater <pii> > pq;
    pq.push(pii(0, node));
    while (pq.size()){
        pii xd = pq.top(); pq.pop();
        int no = xd.second, di = xd.first;
        if (vis[no]) continue;
        vis[no]=1;
        dist[no]=di;
        for (pii i : edges[no]){
            if(vis[i.first])continue;
            pq.push(pii(di+i.second,i.first));
        }
    }
}
void dfs (int node){
    vis[node]=1;
    for (int i:ded[node]){
        if(vis[i])continue;
        dfs(i);
        df_tree[node].push_back(i);
        pa[i][0]=node;
        depth[i]=depth[node]+1;
    }
}
int get_mi (int a, int b){
    int ans = 1e9;
    for (int i=19;i>=0;i--){
        if((1<<i)&b){
            ans=min(ans,mini[a][i]);
            a=pa[a][i];
        }
    }
    return ans;
}
int get_up (int a, int b){
    for (int i=19; i>=0; i--){
        if((1<<i)&b)a=pa[a][i];
    }
    return a;
}
void sol (int node, int p=0){
    if(p==0){
        for(int i:df_tree[node]){
            if (i==p)continue;
            sol(i, node);
        }
        return;
    }
    int miz=depth[node]-1;
    for (int i:rev_ded[node]){
        if(depth[i]<depth[node])miz=min(miz,depth[i]);
    }
    int mi_val = min(miz,get_mi(pa[node][0],depth[pa[node][0]]-miz));
    int up_no = get_up(node, depth[node]-mi_val);
    dom_tree[up_no].push_back(node);
    mini[node][0]=mi_val;
    for (int i=1;i<=19;i++){
        mini[node][i]=min(mini[node][i-1], mini[pa[node][i-1]][i-1]);
    }
    for(int i:df_tree[node]){
        if (i==p)continue;
        sol(i, node);
    }
}
int answ=0;
int su (int node, int p=0){
    int tot=1;
    for (int i:dom_tree[node]){
        if(i==p)continue;
        tot+=su(i,node);
    }
    if(p!=0)answ=max(answ,tot);
    return tot;
}
int main(){
    ios_base::sync_with_stdio(0);
    cin >> n >> m >> s;
    for (int i=0; i<m; i++){
        int a, b, c; cin >> a >> b >> c;
        edges[a].push_back(pii(b, c));
        edges[b].push_back(pii(a, c));
    }
    go(s);
    for (int i=1; i<=n; i++){
        if(!vis[i])continue;
        for (pii j : edges[i]){
            if (dist[j.first] + j.second == dist[i]) {ded[j.first].push_back(i); rev_ded[i].push_back(j.first);}
        }
    }
    memset(vis,0,sizeof(vis));
    dfs (s);
    for (int i=1; i<=19; i++) for (int j=1; j<=n; j++){
        pa[j][i]=pa[pa[j][i-1]][i-1];
    }
    for (int i=1; i<=n; i++) for (int j=0; j<=19; j++) mini[i][j]=1e9;
    sol (s);
    su(s);
    cout<<answ<<'\n';
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define int long long
const int MAXN = 200005;
typedef pair <int, int> pii;
typedef pair <pii, int> piii;
int n, m, s;
vector <pii> edges [MAXN];
int vis [MAXN];
int dist[MAXN];
vector <int> ded [MAXN];
vector <int> rev_ded[MAXN];
vector <int> df_tree [MAXN];
vector <int> dom_tree [MAXN];
int depth[MAXN];
int pa [MAXN][20];
int mini[MAXN][20];
void go (int node){
    priority_queue <pii, vector<pii>, greater <pii> > pq;
    pq.push(pii(0, node));
    while (pq.size()){
        pii xd = pq.top(); pq.pop();
        int no = xd.second, di = xd.first;
        if (vis[no]) continue;
        vis[no]=1;
        dist[no]=di;
        for (pii i : edges[no]){
            if(vis[i.first])continue;
            pq.push(pii(di+i.second,i.first));
        }
    }
}
void dfs (int node, int p=0){
    vis[node]=1;
    depth[node]=depth[p]+1;
    pa[node][0]=p;
    for (int i:ded[node]){
        if(vis[i])continue;
        dfs(i,node);
        df_tree[node].push_back(i);
    }
}
int get_mi (int a, int b){
    int ans = 1e9;
    for (int i=19;i>=0;i--){
        if((1<<i)&b){
            ans=min(ans,mini[a][i]);
            a=pa[a][i];
        }
    }
    return ans;
}
int get_up (int a, int b){
    for (int i=19; i>=0; i--){
        if((1<<i)&b)a=pa[a][i];
    }
    return a;
}
int lca(int a, int b){
    if(depth[a]>depth[b])swap(a,b);
    int zk = depth[b]-depth[a];
    for(int i=19;i>=0;i--){
        if ((1<<i)&zk)b=pa[b][i];
    }
    if(a==b) return a;
    for (int i=19; i>=0; i--){
        if (pa[a][i]!=pa[b][i])a=pa[a][i],b=pa[b][i];
    }
    return pa[a][0];
}
void sol (int node, int p=0){
    if(p==0){
        for(int i:df_tree[node]){
            if (i==p)continue;
            sol(i, node);
        }
        return;
    }
    int miz=depth[node]-1;
    for (int i:rev_ded[node]){
        if(i!=pa[node][0]){
            miz=min(miz,depth[lca(i,node)]);
        }
    }
    int mi_val = min(miz,get_mi(pa[node][0],depth[pa[node][0]]-miz));
    int up_no = get_up(node, depth[node]-mi_val);
    dom_tree[up_no].push_back(node);
    mini[node][0]=mi_val;
    for (int i=1;i<=19;i++){
        mini[node][i]=min(mini[node][i-1], mini[pa[node][i-1]][i-1]);
    }
    for(int i:df_tree[node]){
        if (i==p)continue;
        sol(i, node);
    }
}
int answ=0;
int su (int node, int p=0){
    int tot=1;
    for (int i:dom_tree[node]){
        if(i==p)continue;
        tot+=su(i,node);
    }
    if(p!=0)answ=max(answ,tot);
    return tot;
}
main(){
    ios_base::sync_with_stdio(0);
    cin >> n >> m >> s;
    for (int i=0; i<m; i++){
        int a, b, c; cin >> a >> b >> c;
        edges[a].push_back(pii(b, c));
        edges[b].push_back(pii(a, c));
    }
    go(s);
    for (int i=1; i<=n; i++){
        if(!vis[i])continue;
        for (pii j : edges[i]){
            if (dist[j.first] + j.second == dist[i]) {
                ded[j.first].push_back(i);
                rev_ded[i].push_back(j.first);
            }
        }
    }
    memset(vis,0,sizeof(vis));
    dfs (s);
    for (int i=1; i<=19; i++) for (int j=1; j<=n; j++){
        pa[j][i]=pa[pa[j][i-1]][i-1];
    }
    for (int i=0; i<=n; i++) for (int j=0; j<=19; j++) mini[i][j]=1e9;
    sol (s);
    su(s);
    cout<<answ<<'\n';
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define int long long
const int MAXN = 200005;
typedef pair <int, int> pii;
typedef pair <pii, int> piii;
int n, m, s;
vector <pii> edges [MAXN];
int vis [MAXN];
int dist[MAXN];
vector <int> ded [MAXN];
vector <int> rev_ded[MAXN];
vector <int> df_tree [MAXN];
vector <int> dom_tree [MAXN];
int depth[MAXN];
int pa [MAXN][20];
int mini[MAXN][20];
void go (int node){
    priority_queue <pii, vector<pii>, greater <pii> > pq;
    pq.push(pii(0, node));
    while (pq.size()){
        pii xd = pq.top(); pq.pop();
        int no = xd.second, di = xd.first;
        if (vis[no]) continue;
        vis[no]=1;
        dist[no]=di;
        for (pii i : edges[no]){
            if(vis[i.first])continue;
            pq.push(pii(di+i.second,i.first));
        }
    }
}
void dfs (int node, int p=0){
    vis[node]=1;
    depth[node]=depth[p]+1;
    pa[node][0]=p;
    for (int i:ded[node]){
        if(vis[i])continue;
        dfs(i,node);
        df_tree[node].push_back(i);
    }
}
int get_mi (int a, int b){
    int ans = 1e9;
    for (int i=19;i>=0;i--){
        if((1<<i)&b){
            ans=min(ans,mini[a][i]);
            a=pa[a][i];
        }
    }
    return ans;
}
int get_up (int a, int b){
    for (int i=19; i>=0; i--){
        if((1<<i)&b)a=pa[a][i];
    }
    return a;
}
int lca(int a, int b){
    if(depth[a]>depth[b])swap(a,b);
    int zk = depth[b]-depth[a];
    for(int i=19;i>=0;i--){
        if ((1<<i)&zk)b=pa[b][i];
    }
    if(a==b) return a;
    for (int i=19; i>=0; i--){
        if (pa[a][i]!=pa[b][i])a=pa[a][i],b=pa[b][i];
    }
    return pa[a][0];
}
void sol (int node, int p=0){
    if(p==0){
        for(int i:df_tree[node]){
            if (i==p)continue;
            sol(i, node);
        }
        return;
    }
    int miz=depth[node]-1;
    for (int i:rev_ded[node]){
        if(i!=pa[node][0]){
            miz=min(miz,depth[lca(i,node)]);
        }
    }
    int mi_val = min(miz,get_mi(pa[node][0],depth[pa[node][0]]-miz));
    int up_no = get_up(node, depth[node]-mi_val);
    dom_tree[up_no].push_back(node);
    mini[node][0]=mi_val;
    for (int i=1;i<=19;i++){
        mini[node][i]=min(mini[node][i-1], mini[pa[node][i-1]][i-1]);
    }
    for(int i:df_tree[node]){
        if (i==p)continue;
        sol(i, node);
    }
}
int answ=0;
int su (int node, int p=0){
    int tot=1;
    for (int i:dom_tree[node]){
        if(i==p)continue;
        tot+=su(i,node);
    }
    if(p!=0)answ=max(answ,tot);
    return tot;
}
main(){
    ios_base::sync_with_stdio(0);
    cin >> n >> m >> s;
    for (int i=0; i<m; i++){
        int a, b, c; cin >> a >> b >> c;
        edges[a].push_back(pii(b, c));
        edges[b].push_back(pii(a, c));
    }
    go(s);
    for (int i=1; i<=n; i++){
        if(!vis[i])continue;
        for (pii j : edges[i]){
            if (dist[j.first] + j.second == dist[i]) {
                ded[j.first].push_back(i); rev_ded[i].push_back(j.first);
            }
        }
    }
    memset(vis,0,sizeof(vis));
    dfs (s);
    for (int i=1; i<=19; i++) for (int j=1; j<=n; j++){
        pa[j][i]=pa[pa[j][i-1]][i-1];
    }
    for (int i=1; i<=n; i++) for (int j=0; j<=19; j++) mini[i][j]=1e9;
    sol (s);
    su(s);
    cout<<answ<<'\n';
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define int long long
const int MAXN = 200005;
typedef pair <int, int> pii;
typedef pair <pii, int> piii;
int n, m, s;
vector <pii> edges [MAXN];
int vis [MAXN];
int dist[MAXN];
vector <int> ded [MAXN];
vector <int> rev_ded[MAXN];
vector <int> df_tree [MAXN];
vector <int> dom_tree [MAXN];
int depth[MAXN];
int pa [MAXN][20];
int mini[MAXN][20];
void go (int node){
    priority_queue <pii, vector<pii>, greater <pii> > pq;
    pq.push(pii(0, node));
    while (pq.size()){
        pii xd = pq.top(); pq.pop();
        int no = xd.second, di = xd.first;
        if (vis[no]) continue;
        vis[no]=1;
        dist[no]=di;
        for (pii i : edges[no]){
            if(vis[i.first])continue;
            pq.push(pii(di+i.second,i.first));
        }
    }
}
void dfs (int node, int p=0){
    vis[node]=1;
    if(p!=0)depth[node]=depth[p]+1;
    pa[node][0]=p;
    for (int i:ded[node]){
        if(vis[i])continue;
        dfs(i,node);
        df_tree[node].push_back(i);
    }
}
int get_mi (int a, int b){
    int ans = 1e9;
    for (int i=19;i>=0;i--){
        if((1<<i)&b){
            ans=min(ans,mini[a][i]);
            a=pa[a][i];
        }
    }
    return ans;
}
int get_up (int a, int b){
    for (int i=19; i>=0; i--){
        if((1<<i)&b)a=pa[a][i];
    }
    return a;
}
int lca(int a, int b){
    if(depth[a]>depth[b])swap(a,b);
    int zk = depth[b]-depth[a];
    for(int i=19;i>=0;i--){
        if ((1<<i)&zk)b=pa[b][i];
    }
    if(a==b) return a;
    for (int i=19; i>=0; i--){
        if (pa[a][i]!=pa[b][i])a=pa[a][i],b=pa[b][i];
    }
    return pa[a][0];
}
void sol (int node, int p=0){
    if(p==0){
        for(int i:df_tree[node]){
            if (i==p)continue;
            sol(i, node);
        }
        return;
    }
    int miz=depth[node]-1;
    for (int i:rev_ded[node]){
        if(i!=pa[node][0]){
            miz=min(miz,depth[lca(i,node)]);
        }
    }
    int mi_val = min(miz,get_mi(pa[node][0],depth[pa[node][0]]-miz));
    int up_no = get_up(node, depth[node]-mi_val);
    dom_tree[up_no].push_back(node);
    mini[node][0]=mi_val;
    for (int i=1;i<=19;i++){
        mini[node][i]=min(mini[node][i-1], mini[pa[node][i-1]][i-1]);
    }
    for(int i:df_tree[node]){
        if (i==p)continue;
        sol(i, node);
    }
}
int answ=0;
int su (int node, int p=0){
    int tot=1;
    for (int i:dom_tree[node]){
        if(i==p)continue;
        tot+=su(i,node);
    }
    if(p!=0)answ=max(answ,tot);
    return tot;
}
bool cmp(int a, int b){
    return dist[a]<dist[b];
}
main(){
    ios_base::sync_with_stdio(0);
    cin >> n >> m >> s;
    for (int i=0; i<m; i++){
        int a, b, c; cin >> a >> b >> c;
        edges[a].push_back(pii(b, c));
        edges[b].push_back(pii(a, c));
    }
    go(s);
    vector <int> xd;
    for (int i=1; i<=n; i++){
        if(!vis[i])continue;
        xd.push_back(i);
        for (pii j : edges[i]){
            if (dist[j.first] + j.second == dist[i]) {
                ded[j.first].push_back(i);
                rev_ded[i].push_back(j.first);
            }
        }
    }
    sort(xd.begin(),xd.end(),cmp);
    memset(vis,0,sizeof(vis));
    dfs (s);
    for (int i=1; i<=19; i++) for (int j=1; j<=n; j++){
        pa[j][i]=pa[pa[j][i-1]][i-1];
    }
    for (int i=0; i<=n; i++) for (int j=0; j<=19; j++) mini[i][j]=1e9;
    for (int node:xd){
        if(node==s)continue;
        int miz=depth[node]-1;
        for (int i:rev_ded[node]){
            if(i!=pa[node][0]){
                int gt = lca(i, node);
                miz=min(miz,depth[gt]);
                miz=min(miz,mini[i][0]);
            }
        }
        int mi_val = min(miz,get_mi(pa[node][0],depth[pa[node][0]]-miz));
        int up_no = get_up(node, depth[node]-mi_val);
        dom_tree[up_no].push_back(node);
        mini[node][0]=mi_val;
        for (int i=1;i<=19;i++){
            mini[node][i]=min(mini[node][i-1], mini[pa[node][i-1]][i-1]);
        }
    }
    //sol (s);
    su(s);
    cout<<answ<<'\n';
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define int long long
const int MAXN = 200005;
typedef pair <int, int> pii;
typedef pair <pii, int> piii;
int n, m, s;
vector <pii> edges [MAXN];
int vis [MAXN];
int dist[MAXN];
vector <int> ded [MAXN];
vector <int> rev_ded[MAXN];
vector <int> df_tree [MAXN];
vector <int> dom_tree [MAXN];
int depth[MAXN];
int pa [MAXN][20];
int dom_pa[MAXN][20];
void go (int node){
    priority_queue <pii, vector<pii>, greater <pii> > pq;
    pq.push(pii(0, node));
    while (pq.size()){
        pii xd = pq.top(); pq.pop();
        int no = xd.second, di = xd.first;
        if (vis[no]) continue;
        vis[no]=1;
        dist[no]=di;
        for (pii i : edges[no]){
            if(vis[i.first])continue;
            pq.push(pii(di+i.second,i.first));
        }
    }
}
void dfs (int node, int p=0){
    vis[node]=1;
    if(p!=0)depth[node]=depth[p]+1;
    pa[node][0]=p;
    for (int i:ded[node]){
        if(vis[i])continue;
        dfs(i,node);
        df_tree[node].push_back(i);
    }
}
int lca(int a, int b){
    if(depth[a]>depth[b])swap(a,b);
    int zk = depth[b]-depth[a];
    for(int i=19;i>=0;i--){
        if ((1<<i)&zk)b=dom_pa[b][i];
    }
    if(a==b) return a;
    for (int i=19; i>=0; i--){
        if (dom_pa[a][i]!=dom_pa[b][i])a=dom_pa[a][i],b=dom_pa[b][i];
    }
    return dom_pa[a][0];
}
int answ=0;
int su (int node, int p=0){
    int tot=1;
    for (int i:dom_tree[node]){
        if(i==p)continue;
        tot+=su(i,node);
    }
    if(p!=0)answ=max(answ,tot);
    return tot;
}
bool cmp(int a, int b){
    return dist[a]<dist[b];
}
main(){
    ios_base::sync_with_stdio(0);
    cin >> n >> m >> s;
    for (int i=0; i<m; i++){
        int a, b, c; cin >> a >> b >> c;
        edges[a].push_back(pii(b, c));
        edges[b].push_back(pii(a, c));
    }
    go(s);
    vector <int> xd;
    for (int i=1; i<=n; i++){
        if(!vis[i])continue;
        xd.push_back(i);
        for (pii j : edges[i]){
            if (dist[j.first] + j.second == dist[i]) {
                ded[j.first].push_back(i);
                rev_ded[i].push_back(j.first);
            }
        }
    }
    sort(xd.begin(),xd.end(),cmp);
    memset(vis,0,sizeof(vis));
    dfs (s);
    for (int i=1; i<=19; i++) for (int j=1; j<=n; j++){
        pa[j][i]=pa[pa[j][i-1]][i-1];
    }
    for (int node:xd){
        if(node==s)continue;
        int no = pa[node][0];
        for (int i:rev_ded[node]){
            if(dist[i] < dist[node]){
                no=lca(no,i);
            }
        }
        dom_tree[no].push_back(node);
        dom_pa[node][0]=no;
        for (int i=1;i<=19;i++){
            dom_pa[node][i]=dom_pa[dom_pa[node][i-1]][i-1];
        }
    }
    su(s);
    cout<<answ<<'\n';
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200005;
typedef pair <int, int> pii;
typedef pair <pii, int> piii;
int n, m, s;
vector <pii> edges [MAXN];
int vis [MAXN];
int dist[MAXN];
vector <int> ded [MAXN];
vector <int> df_tree [MAXN];
vector <int> dom_tree [MAXN];
int depth[MAXN];
int pa [MAXN][20];
int mini[MAXN][20];
void go (int node){
    priority_queue <pii, vector<pii>, greater <pii> > pq;
    pq.push(pii(0, node));
    while (pq.size()){
        pii xd = pq.top(); pq.pop();
        int no = xd.second, di = xd.first;
        if (vis[no]) continue;
        vis[no]=1;
        dist[no]=di;
        for (pii i : edges[no]){
            if(vis[i.first])continue;
            pq.push(pii(di+i.second,i.first));
        }
    }
}
void dfs (int node){
    vis[node]=1;
    for (int i:ded[node]){
        if(vis[i])continue;
        dfs(i);
        df_tree[node].push_back(i);
        pa[i][0]=node;
        depth[i]=depth[node]+1;
    }
}
int get_mi (int a, int b){
    int ans = 1e9;
    for (int i=19;i>=0;i--){
        if((1<<i)&b){
            ans=min(ans,mini[a][i]);
            a=pa[a][i];
        }
    }
    return ans;
}
int get_up (int a, int b){
    for (int i=19; i>=0; i--){
        if((1<<i)&b)a=pa[a][i];
    }
    return a;
}
void sol (int node, int p=0){
    if(p==0){
        for(int i:df_tree[node]){
            if (i==p)continue;
            sol(i, node);
        }
        return;
    }
    int miz=depth[node]-1;
    for (int i:ded[node]){
        if(depth[i]<depth[node])miz=min(miz,depth[i]);
    }
    int mi_val = min(miz,get_mi(pa[node][0],depth[pa[node][0]]-miz));
    int up_no = get_up(node, depth[node]-mi_val);
    dom_tree[up_no].push_back(node);
    mini[node][0]=mi_val;
    for (int i=1;i<=19;i++){
        mini[node][i]=min(mini[node][i-1], mini[pa[node][i-1]][i-1]);
    }
    for(int i:df_tree[node]){
        if (i==p)continue;
        sol(i, node);
    }
}
int answ=0;
int su (int node, int p=0){
    int tot=1;
    for (int i:dom_tree[node]){
        if(i==p)continue;
        tot+=su(i,node);
    }
    if(p!=0)answ=max(answ,tot);
    return tot;
}
int main(){
    ios_base::sync_with_stdio(0);
    cin >> n >> m >> s;
    for (int i=0; i<m; i++){
        int a, b, c; cin >> a >> b >> c;
        edges[a].push_back(pii(b, c));
        edges[b].push_back(pii(a, c));
    }
    go(s);
    for (int i=1; i<=n; i++){
        for (pii j : edges[i]){
            if (dist[j.first] + j.second == dist[i]) ded[j.first].push_back(i);
        }
    }
    memset(vis,0,sizeof(vis));
    dfs (s);
    for (int i=1; i<=19; i++) for (int j=1; j<=n; j++){
        pa[j][i]=pa[pa[j][i-1]][i-1];
    }
    for (int i=1; i<=n; i++) for (int j=0; j<=19; j++) mini[i][j]=1e9;
    sol (s);
    su(s);
    cout<<answ<<'\n';
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200005;
typedef pair <int, int> pii;
typedef pair <pii, int> piii;
int n, m, s;
vector <pii> edges [MAXN];
int vis [MAXN];
int dist[MAXN];
vector <int> ded [MAXN];
vector <int> rev_ded[MAXN];
vector <int> df_tree [MAXN];
vector <int> dom_tree [MAXN];
int depth[MAXN];
int pa [MAXN][20];
int mini[MAXN][20];
void go (int node){
    priority_queue <pii, vector<pii>, greater <pii> > pq;
    pq.push(pii(0, node));
    while (pq.size()){
        pii xd = pq.top(); pq.pop();
        int no = xd.second, di = xd.first;
        if (vis[no]) continue;
        vis[no]=1;
        dist[no]=di;
        for (pii i : edges[no]){
            if(vis[i.first])continue;
            pq.push(pii(di+i.second,i.first));
        }
    }
}
void dfs (int node){
    vis[node]=1;
    for (int i:ded[node]){
        if(vis[i])continue;
        dfs(i);
        df_tree[node].push_back(i);
        pa[i][0]=node;
        depth[i]=depth[node]+1;
    }
}
int get_mi (int a, int b){
    int ans = 1e9;
    for (int i=19;i>=0;i--){
        if((1<<i)&b){
            ans=min(ans,mini[a][i]);
            a=pa[a][i];
        }
    }
    return ans;
}
int get_up (int a, int b){
    for (int i=19; i>=0; i--){
        if((1<<i)&b)a=pa[a][i];
    }
    return a;
}
int lca(int a, int b){
    if(depth[a]>depth[b])swap(a,b);
    int zk = depth[b]-depth[a];
    for(int i=19;i>=0;i--){
        if ((1<<i)&zk)b=pa[b][i];
    }
    if(a==b) return a;
    for (int i=19; i>=0; i--){
        if (pa[a][i]!=pa[b][i])a=pa[a][i],b=pa[b][i];
    }
    return pa[a][0];
}
void sol (int node, int p=0){
    if(p==0){
        for(int i:df_tree[node]){
            if (i==p)continue;
            sol(i, node);
        }
        return;
    }
    int miz=depth[node]-1;
    for (int i:rev_ded[node]){
        if(i!=pa[node][0]){
            miz=min(miz,depth[lca(i,node)]);
        }
    }
    int mi_val = min(miz,get_mi(pa[node][0],depth[pa[node][0]]-miz));
    int up_no = get_up(node, depth[node]-mi_val);
    dom_tree[up_no].push_back(node);
    mini[node][0]=mi_val;
    for (int i=1;i<=19;i++){
        mini[node][i]=min(mini[node][i-1], mini[pa[node][i-1]][i-1]);
    }
    for(int i:df_tree[node]){
        if (i==p)continue;
        sol(i, node);
    }
}
int answ=0;
int su (int node, int p=0){
    int tot=1;
    for (int i:dom_tree[node]){
        if(i==p)continue;
        tot+=su(i,node);
    }
    if(p!=0)answ=max(answ,tot);
    return tot;
}
int main(){
    ios_base::sync_with_stdio(0);
    cin >> n >> m >> s;
    for (int i=0; i<m; i++){
        int a, b, c; cin >> a >> b >> c;
        edges[a].push_back(pii(b, c));
        edges[b].push_back(pii(a, c));
    }
    go(s);
    for (int i=1; i<=n; i++){
        if(!vis[i])continue;
        for (pii j : edges[i]){
            if (dist[j.first] + j.second == dist[i]) {ded[j.first].push_back(i); rev_ded[i].push_back(j.first);}
        }
    }
    memset(vis,0,sizeof(vis));
    dfs (s);
    for (int i=1; i<=19; i++) for (int j=1; j<=n; j++){
        pa[j][i]=pa[pa[j][i-1]][i-1];
    }
    for (int i=1; i<=n; i++) for (int j=0; j<=19; j++) mini[i][j]=1e9;
    sol (s);
    su(s);
    cout<<answ<<'\n';
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define int long long
const int MAXN = 200005;
typedef pair <int, int> pii;
typedef pair <pii, int> piii;
int n, m, s;
vector <pii> edges [MAXN];
int vis [MAXN];
int dist[MAXN];
vector <int> ded [MAXN];
vector <int> df_tree [MAXN];
vector <int> dom_tree [MAXN];
int depth[MAXN];
int pa [MAXN][20];
int mini[MAXN][20];
void go (int node){
    priority_queue <pii, vector<pii>, greater <pii> > pq;
    pq.push(pii(0, node));
    while (pq.size()){
        pii xd = pq.top(); pq.pop();
        int no = xd.second, di = xd.first;
        if (vis[no]) continue;
        vis[no]=1;
        dist[no]=di;
        for (pii i : edges[no]){
            if(vis[i.first])continue;
            pq.push(pii(di+i.second,i.first));
        }
    }
}
void dfs (int node){
    vis[node]=1;
    for (int i:ded[node]){
        if(vis[i])continue;
        dfs(i);
        df_tree[node].push_back(i);
        pa[i][0]=node;
        depth[i]=depth[node]+1;
    }
}
int get_mi (int a, int b){
    int ans = 1e9;
    for (int i=19;i>=0;i--){
        if((1<<i)&b){
            ans=min(ans,mini[a][i]);
            a=pa[a][i];
        }
    }
    return ans;
}
int get_up (int a, int b){
    for (int i=19; i>=0; i--){
        if((1<<i)&b)a=pa[a][i];
    }
    return a;
}
void sol (int node, int p=0){
    if(p==0){
        for(int i:df_tree[node]){
            if (i==p)continue;
            sol(i, node);
        }
        return;
    }
    int miz=depth[node]-1;
    for (int i:ded[node]){
        if(depth[i]<depth[node])miz=min(miz,depth[i]);
    }
    int mi_val = min(miz,get_mi(pa[node][0],depth[pa[node][0]]-miz));
    int up_no = get_up(node, depth[node]-mi_val);
    dom_tree[up_no].push_back(node);
    mini[node][0]=mi_val;
    for (int i=1;i<=19;i++){
        mini[node][i]=min(mini[node][i-1], mini[pa[node][i-1]][i-1]);
    }
    for(int i:df_tree[node]){
        if (i==p)continue;
        sol(i, node);
    }
}
int answ=0;
int su (int node, int p=0){
    int tot=1;
    for (int i:dom_tree[node]){
        if(i==p)continue;
        tot+=su(i,node);
    }
    if(p!=0)answ=max(answ,tot);
    return tot;
}
main(){
    ios_base::sync_with_stdio(0);
    cin >> n >> m >> s;
    for (int i=0; i<m; i++){
        int a, b, c; cin >> a >> b >> c;
        edges[a].push_back(pii(b, c));
        edges[b].push_back(pii(a, c));
    }
    go(s);
    for (int i=1; i<=n; i++){
        for (pii j : edges[i]){
            if (dist[j.first] + j.second == dist[i]) ded[j.first].push_back(i);
        }
    }
    memset(vis,0,sizeof(vis));
    dfs (s);
    for (int i=1; i<=19; i++) for (int j=1; j<=n; j++){
        pa[j][i]=pa[pa[j][i-1]][i-1];
    }
    for (int i=1; i<=n; i++) for (int j=0; j<=19; j++) mini[i][j]=1e9;
    sol (s);
    su(s);
    cout<<answ<<'\n';
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int MAXN=200005;
const int MAXM=300005;
const long long INF=9223372036854775807;

int n,m,s,maxn;
inline int read(){
	int x=0,f=1;char ch=getchar();
	while(!isdigit(ch)){if(ch=='-') f=-f;ch=getchar();}
	while(isdigit(ch)){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

struct Graph{
	int head[MAXN],trump;
	Graph(){
		memset(head,0,sizeof(head));
		trump=0;
	}
	struct Edge{
		int from,to,next;
		long long val;
	}e[MAXM<<1];
	inline void AddDirectedEgde(int u,int v,long long w=0){
		e[++trump]=(Edge){u,v,head[u],w};head[u]=trump;
	}
	inline void AddIndirectedEdge(int u,int v,long long w=0){
		e[++trump]=(Edge){u,v,head[u],w};head[u]=trump;
		e[++trump]=(Edge){v,u,head[v],w};head[v]=trump;
	}
}G[3];

long long dist[MAXN];
bool vis[MAXN];
struct Node{
	int id,dis;
	Node(int id=0,int dis=0):id(id),dis(dis){};
	bool operator < (const Node &tmp)const{
		return dis>tmp.dis;
	}
};
inline void dijkstra(long long *dist,const Graph &G,const int &s){
	register int i,u,v;
	priority_queue<Node> q;
	for(i=1;i<=n;++i) dist[i]=INF,vis[i]=0;
	dist[s]=0;q.push(Node(s,0));
	while(!q.empty()){
		u=q.top().id;q.pop();
		if(vis[u]) continue;vis[u]=1;
		for(i=G.head[u];i;i=G.e[i].next){
			v=G.e[i].to;
			if(dist[v]>dist[u]+G.e[i].val){
				dist[v]=dist[u]+G.e[i].val;
				q.push(Node(v,dist[v]));
			}
		}
	}
}

int in[MAXN];
int dep[MAXN],f[MAXN][18];
inline int lca(int u,int v){
	if(dep[u]<dep[v]) swap(u,v);
	for(register int i=17;~i;--i) if(dep[f[u][i]]>=dep[v]) u=f[u][i];
	if(u==v) return u;
	for(register int i=17;~i;--i) if(f[u][i]!=f[v][i]) u=f[u][i],v=f[v][i];
	return f[u][0];
}
inline void topo(const Graph &M){
	register int i,u,v;
	queue<int> q;
	q.push(s);
	while(!q.empty()){
		u=q.front();q.pop();
		dep[u]=dep[f[u][0]]+1;
		if(f[u][0]) G[2].AddDirectedEgde(f[u][0],u);
		for(i=1;i<18;++i) f[u][i]=f[f[u][i-1]][i-1];
		for(i=M.head[u];i;i=M.e[i].next){
			v=M.e[i].to;
			if(!f[v][0]) f[v][0]=u;
			else f[v][0]=lca(f[v][0],u);
			if(!--in[v]) q.push(v);
		}
	}
}

int size[MAXN];
void dfs(int u,const Graph &G){
	size[u]=1;
	for(register int i=G.head[u];i;i=G.e[i].next){
		int v=G.e[i].to;dfs(v,G);
		size[u]+=size[v];
	}
}

int main(){
	n=read();m=read();s=read();
	register int i,j;
	for(i=1;i<=m;++i){
		int u=read(),v=read(),w=read();
		G[0].AddIndirectedEdge(u,v,w);
	}
	dijkstra(dist,G[0],s);
	for(i=1;i<=G[0].trump;++i)
		if(dist[G[0].e[i].from]+G[0].e[i].val==dist[G[0].e[i].to])
			G[1].AddDirectedEgde(G[0].e[i].from,G[0].e[i].to),++in[G[0].e[i].to];
	topo(G[1]);dfs(s,G[2]);
	for(i=1;i<=n;++i)
		if(i!=s) maxn=max(maxn,size[i]);
	printf("%d",maxn);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int MAXN=200005;
const int MAXM=300005;
const int INF=2147483647;

int n,m,s;
int maxn,pos;
inline int read(){
	int x=0,f=1;char ch=getchar();
	while(!isdigit(ch)){if(ch=='-') f=-f;ch=getchar();}
	while(isdigit(ch)){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

struct Graph{
	int head[MAXN],trump;
	Graph(){
		memset(head,0,sizeof(head));
		trump=0;
	}
	struct Edge{
		int from,to,next,val;
	}e[MAXM<<1];
	inline void AddDirectedEgde(int u,int v,int w=0){
		e[++trump]=(Edge){u,v,head[u],w};head[u]=trump;
	}
	inline void AddIndirectedEdge(int u,int v,int w=0){
		e[++trump]=(Edge){u,v,head[u],w};head[u]=trump;
		e[++trump]=(Edge){v,u,head[v],w};head[v]=trump;
	}
}G[3];

int dist[MAXN];
bool vis[MAXN];
struct Node{
	int id,dis;
	Node(int id=0,int dis=0):id(id),dis(dis){};
	bool operator < (const Node &tmp)const{
		return dis>tmp.dis;
	}
};
inline void dijkstra(int *dist,const Graph &G,const int &s){
	register int i,u,v;
	priority_queue<Node> q;
	for(i=1;i<=n;++i) dist[i]=INF,vis[i]=0;
	dist[s]=0;q.push(Node(s,0));
	while(!q.empty()){
		u=q.top().id;q.pop();
		if(vis[u]) continue;vis[u]=1;
		for(i=G.head[u];i;i=G.e[i].next){
			v=G.e[i].to;
			if(dist[v]>dist[u]+G.e[i].val){
				dist[v]=dist[u]+G.e[i].val;
				q.push(Node(v,dist[v]));
			}
		}
	}
}

int in[MAXN];
int dep[MAXN],f[MAXN][18];
inline int lca(int u,int v){
	if(dep[u]<dep[v]) swap(u,v);
	for(register int i=17;~i;--i) if(dep[f[u][i]]>=dep[v]) u=f[u][i];
	if(u==v) return u;
	for(register int i=17;~i;--i) if(f[u][i]!=f[v][i]) u=f[u][i],v=f[v][i];
	return f[u][0];
}
inline void topo(const Graph &M){
	register int i,u,v;
	queue<int> q;
	q.push(s);
	while(!q.empty()){
		u=q.front();q.pop();
		dep[u]=dep[f[u][0]]+1;
		if(f[u][0]) G[2].AddDirectedEgde(f[u][0],u);
		for(i=1;i<18;++i) f[u][i]=f[f[u][i-1]][i-1];
		for(i=M.head[u];i;i=M.e[i].next){
			v=M.e[i].to;
			if(!f[v][0]) f[v][0]=u;
			else f[v][0]=lca(f[v][0],u);
			if(!--in[v]) q.push(v);
		}
	}
}

int size[MAXN];
void dfs(int u,const Graph &G){
	size[u]=1;
	for(register int i=G.head[u];i;i=G.e[i].next){
		int v=G.e[i].to;dfs(v,G);
		size[u]+=size[v];
	}
}

int main(){
	n=read();m=read();s=read();
	register int i,j;
	for(i=1;i<=m;++i){
		int u=read(),v=read(),w=read();
		G[0].AddIndirectedEdge(u,v,w);
	}
	dijkstra(dist,G[0],s);
	for(i=1;i<=G[0].trump;++i)
		if(dist[G[0].e[i].from]+G[0].e[i].val==dist[G[0].e[i].to])
			G[1].AddDirectedEgde(G[0].e[i].from,G[0].e[i].to),++in[G[0].e[i].to];
	topo(G[1]);dfs(s,G[2]);
	for(i=1;i<=n;++i)
		if(i!=s) maxn=max(maxn,size[i]);
	printf("%d",maxn);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int MAXN=200005;
const int MAXM=300005;
const int INF=2147483647;

int n,m,s;
int maxn,pos;
inline int read(){
	int x=0,f=1;char ch=getchar();
	while(!isdigit(ch)){if(ch=='-') f=-f;ch=getchar();}
	while(isdigit(ch)){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

struct Graph{
	int head[MAXN],trump;
	Graph(){
		memset(head,0,sizeof(head));
		trump=0;
	}
	struct Edge{
		int from,to,next,val;
	}e[MAXM<<1];
	inline void AddDirectedEgde(int u,int v,int w=0){
		e[++trump]=(Edge){u,v,head[u],w};head[u]=trump;
	}
	inline void AddIndirectedEdge(int u,int v,int w=0){
		e[++trump]=(Edge){u,v,head[u],w};head[u]=trump;
		e[++trump]=(Edge){v,u,head[v],w};head[v]=trump;
	}
}G[3];

int dist[MAXN];
bool vis[MAXN];
struct Node{
	int id,dis;
	Node(int id=0,int dis=0):id(id),dis(dis){};
	bool operator < (const Node &tmp)const{
		return dis<tmp.dis;
	}
};
inline void dijkstra(int *dist,const Graph &G,const int &s){
	register int i,u,v;
	priority_queue<Node> q;
	for(i=1;i<=n;++i) dist[i]=INF,vis[i]=0;
	dist[s]=0;q.push(Node(s,0));
	while(!q.empty()){
		u=q.top().id;q.pop();
		if(vis[u]) continue;vis[u]=1;
		for(i=G.head[u];i;i=G.e[i].next){
			v=G.e[i].to;
			if(dist[v]>dist[u]+G.e[i].val){
				dist[v]=dist[u]+G.e[i].val;
				q.push(Node(v,dist[v]));
			}
		}
	}
}

int in[MAXN];
int dep[MAXN],f[MAXN][18];
inline int lca(int u,int v){
	if(dep[u]<dep[v]) swap(u,v);
	for(register int i=17;~i;--i) if(dep[f[u][i]]>=dep[v]) u=f[u][i];
	if(u==v) return u;
	for(register int i=17;~i;--i) if(f[u][i]!=f[v][i]) u=f[u][i],v=f[v][i];
	return f[u][0];
}
inline void topo(const Graph &M){
	register int i,u,v;
	queue<int> q;
	q.push(s);
	while(!q.empty()){
		u=q.front();q.pop();
		dep[u]=dep[f[u][0]]+1;
		if(f[u][0]) G[2].AddDirectedEgde(f[u][0],u);
		for(i=1;i<18;++i) f[u][i]=f[f[u][i-1]][i-1];
		for(i=M.head[u];i;i=M.e[i].next){
			v=M.e[i].to;
			if(!f[v][0]) f[v][0]=u;
			else f[v][0]=lca(f[v][0],u);
			if(!--in[v]) q.push(v);
		}
	}
}

int size[MAXN];
void dfs(int u,const Graph &G){
	size[u]=1;
	for(register int i=G.head[u];i;i=G.e[i].next){
		int v=G.e[i].to;dfs(v,G);
		size[u]+=size[v];
	}
}

int main(){
	n=read();m=read();s=read();
	register int i,j;
	for(i=1;i<=m;++i){
		int u=read(),v=read(),w=read();
		G[0].AddIndirectedEdge(u,v,w);
	}
	dijkstra(dist,G[0],s);
	for(i=1;i<=G[0].trump;++i)
		if(dist[G[0].e[i].from]+G[0].e[i].val==dist[G[0].e[i].to])
			G[1].AddDirectedEgde(G[0].e[i].from,G[0].e[i].to),++in[G[0].e[i].to];
	topo(G[1]);dfs(s,G[2]);
	for(i=1;i<=n;++i)
		if(size[i]>maxn&&i!=s) maxn=size[i],pos=i;
	printf("%d",pos);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int MAXN=200005;
const int MAXM=300005;
const int INF=2147483647;

int n,m,s;
int maxn,pos;
inline int read(){
	int x=0,f=1;char ch=getchar();
	while(!isdigit(ch)){if(ch=='-') f=-f;ch=getchar();}
	while(isdigit(ch)){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

struct Graph{
	int head[MAXN],trump;
	Graph(){
		memset(head,0,sizeof(head));
		trump=0;
	}
	struct Edge{
		int from,to,next,val;
	}e[MAXM<<1];
	inline void AddDirectedEgde(int u,int v,int w=0){
		e[++trump]=(Edge){u,v,head[u],w};head[u]=trump;
	}
	inline void AddIndirectedEdge(int u,int v,int w=0){
		e[++trump]=(Edge){u,v,head[u],w};head[u]=trump;
		e[++trump]=(Edge){v,u,head[v],w};head[v]=trump;
	}
}G[3];

int dist[MAXN];
bool vis[MAXN];
struct Node{
	int id,dis;
	Node(int id=0,int dis=0):id(id),dis(dis){};
	bool operator < (const Node &tmp)const{
		return dis<tmp.dis;
	}
};
inline void dijkstra(int *dist,const Graph &G,const int &s){
	register int i,u,v;
	priority_queue<Node> q;
	for(i=1;i<=n;++i) dist[i]=INF,vis[i]=0;
	dist[s]=0;q.push(Node(s,0));
	while(!q.empty()){
		u=q.top().id;q.pop();
		if(vis[u]) continue;vis[u]=1;
		for(i=G.head[u];i;i=G.e[i].next){
			v=G.e[i].to;
			if(dist[v]>dist[u]+G.e[i].val){
				dist[v]=dist[u]+G.e[i].val;
				q.push(Node(v,dist[v]));
			}
		}
	}
}

int in[MAXN];
int dep[MAXN],f[MAXN][18];
inline int lca(int u,int v){
	if(dep[u]<dep[v]) swap(u,v);
	for(register int i=17;~i;--i) if(dep[f[u][i]]>=dep[v]) u=f[u][i];
	if(u==v) return u;
	for(register int i=17;~i;--i) if(f[u][i]!=f[v][i]) u=f[u][i],v=f[v][i];
	return f[u][0];
}
inline void topo(const Graph &M){
	register int i,u,v;
	queue<int> q;
	q.push(s);
	while(!q.empty()){
		u=q.front();q.pop();
		dep[u]=dep[f[u][0]]+1;
		if(f[u][0]) G[2].AddDirectedEgde(f[u][0],u);
		for(i=1;i<18;++i) f[u][i]=f[f[u][i-1]][i-1];
		for(i=M.head[u];i;i=M.e[i].next){
			v=M.e[i].to;
			if(!f[v][0]) f[v][0]=u;
			else f[v][0]=lca(f[v][0],u);
			if(!--in[v]) q.push(v);
		}
	}
}

int size[MAXN];
void dfs(int u,const Graph &G){
	size[u]=1;
	for(register int i=G.head[u];i;i=G.e[i].next){
		int v=G.e[i].to;dfs(v,G);
		size[u]+=size[v];
	}
}

int main(){
	n=read();m=read();s=read();
	register int i,j;
	for(i=1;i<=m;++i){
		int u=read(),v=read(),w=read();
		G[0].AddIndirectedEdge(u,v,w);
	}
	dijkstra(dist,G[0],s);
	for(i=1;i<=G[0].trump;++i)
		if(dist[G[0].e[i].from]+G[0].e[i].val==dist[G[0].e[i].to])
			G[1].AddDirectedEgde(G[0].e[i].from,G[0].e[i].to),++in[G[0].e[i].to];
	topo(G[1]);dfs(s,G[2]);
	for(i=1;i<=n;++i)
		if(i!=s) maxn=max(maxn,size[i]);
	printf("%d",maxn);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int MAXN=200005;
const int MAXM=300005;
const long long INF=9223372036854775807;

int n,m,s,maxn;
inline int read(){
	int x=0,f=1;char ch=getchar();
	while(!isdigit(ch)){if(ch=='-') f=-f;ch=getchar();}
	while(isdigit(ch)){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

struct Graph{
	int head[MAXN],trump;
	Graph(){
		memset(head,0,sizeof(head));
		trump=0;
	}
	struct Edge{
		int from,to,next;
		long long val;
	}e[MAXM<<1];
	inline void AddDirectedEgde(int u,int v,long long w=0){
		e[++trump]=(Edge){u,v,head[u],w};head[u]=trump;
	}
	inline void AddIndirectedEdge(int u,int v,long long w=0){
		e[++trump]=(Edge){u,v,head[u],w};head[u]=trump;
		e[++trump]=(Edge){v,u,head[v],w};head[v]=trump;
	}
}G[3];

long long dist[MAXN];
bool vis[MAXN];
struct Node{
	int id;
	long long dis;
	Node(int id=0,long long dis=0):id(id),dis(dis){};
	bool operator < (const Node &tmp)const{
		return dis>tmp.dis;
	}
};
inline void dijkstra(long long *dist,const Graph &G,const int &s){
	register int i,u,v;
	priority_queue<Node> q;
	for(i=1;i<=n;++i) dist[i]=INF,vis[i]=0;
	dist[s]=0;q.push(Node(s,0));
	while(!q.empty()){
		u=q.top().id;q.pop();
		if(vis[u]) continue;vis[u]=1;
		for(i=G.head[u];i;i=G.e[i].next){
			v=G.e[i].to;
			if(dist[v]>dist[u]+G.e[i].val){
				dist[v]=dist[u]+G.e[i].val;
				q.push(Node(v,dist[v]));
			}
		}
	}
}

int in[MAXN];
int dep[MAXN],f[MAXN][18];
inline int lca(int u,int v){
	if(dep[u]<dep[v]) swap(u,v);
	for(register int i=17;~i;--i) if(dep[f[u][i]]>=dep[v]) u=f[u][i];
	if(u==v) return u;
	for(register int i=17;~i;--i) if(f[u][i]!=f[v][i]) u=f[u][i],v=f[v][i];
	return f[u][0];
}
inline void topo(const Graph &M){
	register int i,u,v;
	queue<int> q;
	q.push(s);
	while(!q.empty()){
		u=q.front();q.pop();
		dep[u]=dep[f[u][0]]+1;
		if(f[u][0]) G[2].AddDirectedEgde(f[u][0],u);
		for(i=1;i<18;++i) f[u][i]=f[f[u][i-1]][i-1];
		for(i=M.head[u];i;i=M.e[i].next){
			v=M.e[i].to;
			if(!f[v][0]) f[v][0]=u;
			else f[v][0]=lca(f[v][0],u);
			if(!--in[v]) q.push(v);
		}
	}
}

int size[MAXN];
void dfs(int u,const Graph &G){
	size[u]=1;
	for(register int i=G.head[u];i;i=G.e[i].next){
		int v=G.e[i].to;dfs(v,G);
		size[u]+=size[v];
	}
}

int main(){
	n=read();m=read();s=read();
	register int i,j;
	for(i=1;i<=m;++i){
		int u=read(),v=read(),w=read();
		G[0].AddIndirectedEdge(u,v,w);
	}
	dijkstra(dist,G[0],s);
	for(i=1;i<=G[0].trump;++i)
		if(dist[G[0].e[i].from]+G[0].e[i].val==dist[G[0].e[i].to])
			G[1].AddDirectedEgde(G[0].e[i].from,G[0].e[i].to),++in[G[0].e[i].to];
	topo(G[1]);dfs(s,G[2]);
	for(i=1;i<=n;++i)
		if(i!=s) maxn=max(maxn,size[i]);
	printf("%d",maxn);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long i64;

const i64 INF = 0x3F3F3F3F3F3F3F3F;

const int NMAX = 2e5 + 5,
          BMAX = 1 << 17,
            LG = 18;

struct PII {
    int v, c;

    inline PII() { }
    inline PII(int _v, int _c) {
        v = _v;
        c = _c; } };

struct Nod {
    int idx, far;
    i64 d;

    inline Nod() { }
    inline Nod(int _idx, int _far, i64 _d) {
        idx = _idx;
        far = _far;
        d = _d; }

    inline bool operator < (const Nod &arg) const {
        return (d == arg.d) ? (idx < arg.idx) : (d < arg.d); } };

int n, m, s;

vector<PII> g[NMAX];
vector<int> res[NMAX], dom[NMAX];

i64  dist[NMAX];
int   lev[NMAX], dsiz[NMAX], far[LG + 1][NMAX];
char buff[BMAX];

inline char nextch(void) {
    static int bp = BMAX;

    if (bp == BMAX) {
        fread(buff, 1, BMAX, stdin);
        bp = 0; }

    return buff[ bp++ ]; }

void get(int &arg) {
    char ch;
    do {
        ch = nextch(); }
    while (ch < '0' || ch > '9');
    arg = 0;
    do {
        arg = arg * 10 + ch - '0';
        ch = nextch(); }
    while (ch >= '0' && ch <= '9'); }

inline int lca(int a, int b) {
    if (lev[a] < lev[b])
        swap(a, b);

    for (int lg = 0; lg <= LG; ++lg)
        if ((lev[a] - lev[b]) & (1 << lg))
            a = far[lg][a];

    if (a == b) return a;

    for (int lg = LG; lg >= 0; --lg)
        if (far[lg][a] != far[lg][b]) {
            a = far[lg][a];
            b = far[lg][b]; }

    return far[0][a]; }

void r_dfs(int u, int p = 0) {
    for (auto v: res[u]) if (v != p) {
        lev[v] = lev[u] + 1;
        r_dfs(v, u); } }

void d_dfs(int u, int p = 0) {
    dsiz[u] = 1;
    for (auto v: dom[u]) if (v != p) {
        d_dfs(v, u);
        dsiz[u]+= dsiz[v]; } }

void dijkstra(void) {
    set<Nod> pq;
    Nod tp;
    int ln;

    memset(dist, 0x3F, sizeof dist);
    pq.emplace(s, 0, 0);
    dist[s] = 0LL;
    ln = n - 1;

    while (!pq.empty()) {
        tp = *pq.begin();
        pq.erase(pq.begin());

        for (auto v: g[tp.idx]) {
            if (dist[v.v] == INF) {
                pq.emplace(v.v, tp.idx, dist[tp.idx] + v.c);
                dist[v.v] = dist[tp.idx] + v.c;
                far[0][v.v] = tp.idx; }
            else if (dist[tp.idx] + v.c < dist[v.v]) {
                pq.erase(pq.find(Nod(v.v, NULL, dist[v.v])));
                pq.emplace(v.v, tp.idx, dist[tp.idx] + v.c);
                dist[v.v] = dist[tp.idx] + v.c;
                far[0][v.v] = tp.idx; } } }

    for (int u = 1; u <= n; ++u) if (u != s && dist[u] != INF)
        res[far[0][u]].push_back(u);

    for (int lg = 1; lg <= LG; ++lg)
    for (int i = 1; i <= n; ++i)
        far[lg][i] = far[lg - 1][far[lg - 1][i]];

    r_dfs(s); }

void make_dom(void) {
    int god, lc;

    for (int u = 1; u <= n; ++u) if (u != s && dist[u] != INF) {
        god = far[0][u];
        for (auto v: g[u]) if (dist[v.v] + v.c == dist[u]) {
            lc = lca(u, v.v);
            if (lev[lc] < lev[god])
                god = lc; }
        dom[god].push_back(u); }

    d_dfs(s); }

int main(void) {
    //freopen("dat.in", "r", stdin);
    int a, b, c, ant;

    ant = 0;

    get(n), get(m), get(s);
    for (int i = 0; i < m; ++i) {
        get(a), get(b), get(c);
        g[a].emplace_back(b, c);
        g[b].emplace_back(a, c); }

    dijkstra();
    make_dom();

    for (auto v: dom[s])
        ant = max(ant, dsiz[v]);

    printf("%d\n", ant);

    return 0; }


#include <bits/stdc++.h>
using namespace std;

typedef long long i64;

const i64 INF = 0x3F3F3F3F3F3F3F3F;

const int NMAX = 1e5 + 5,
            LG = 17;

struct PII {
    int v, c;

    inline PII() { }
    inline PII(int _v, int _c) {
        v = _v;
        c = _c; } };

struct Nod {
    int idx, far, d;

    inline Nod() { }
    inline Nod(int _idx, int _far, int _d) {
        idx = _idx;
        far = _far;
        d = _d; }

    bool operator < (const Nod &arg) const {
        return (d == arg.d) ? (idx < arg.idx) : (d < arg.d); } };

int n, m, s;

vector<PII> g[NMAX];
vector<int> res[NMAX], dom[NMAX];

i64 dist[NMAX];
int  lev[NMAX], dsiz[NMAX], far[LG + 1][NMAX];

int lca(int a, int b) {
    if (lev[a] < lev[b])
        swap(a, b);

    for (int lg = 0; lg <= LG; ++lg)
        if ((lev[a] - lev[b]) & (1 << lg))
            a = far[lg][a];

    if (a == b) return a;

    for (int lg = LG; lg >= 0; --lg)
        if (far[lg][a] != far[lg][b]) {
            a = far[lg][a];
            b = far[lg][b]; }

    return far[0][a]; }

void r_dfs(int u, int p = 0) {
    for (auto v: res[u]) if (v != p) {
        lev[v] = lev[u] + 1;
        r_dfs(v, u); } }

void d_dfs(int u, int p = 0) {
    dsiz[u] = 1;
    for (auto v: dom[u]) if (v != p) {
        d_dfs(v, u);
        dsiz[u]+= dsiz[v]; } }

void dijkstra(void) {
    set<Nod> pq;
    Nod tp;
    int ln;

    memset(dist, 0x3F, sizeof dist);
    pq.emplace(s, 0, 0);
    dist[s] = 0LL;
    ln = n - 1;

    while (!pq.empty()) {
        tp = *pq.begin();
        pq.erase(pq.begin());

        for (auto v: g[tp.idx]) {
            if (dist[v.v] == INF) {
                pq.emplace(v.v, tp.idx, dist[tp.idx] + v.c);
                dist[v.v] = dist[tp.idx] + v.c;
                far[0][v.v] = tp.idx; }
            else if (dist[tp.idx] + v.c < dist[v.v]) {
                pq.erase(pq.find(Nod(v.v, NULL, dist[v.v])));
                pq.emplace(v.v, tp.idx, dist[tp.idx] + v.c);
                dist[v.v] = dist[tp.idx] + v.c;
                far[0][v.v] = tp.idx; } } }

    for (int u = 1; u <= n; ++u) if (u != s && dist[u] != INF)
        res[far[0][u]].push_back(u);

    for (int lg = 1; lg <= LG; ++lg)
    for (int i = 1; i <= n; ++i)
        far[lg][i] = far[lg - 1][far[lg - 1][i]];

    r_dfs(s); }

void make_dom(void) {
    int god, lc;

    for (int u = 1; u <= n; ++u) if (u != s && dist[u] != INF) {
        god = far[0][u];
        for (auto v: g[u]) if (dist[v.v] + v.c == dist[u]) {
            lc = lca(u, v.v);
            if (lev[lc] < lev[god])
                god = lc; }
        dom[god].push_back(u); }

    d_dfs(s); }

int main(void) {
    //freopen("dat.in", "r", stdin);
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    int a, b, c, ant;

    ant = 0;

    cin >> n >> m >> s;
    for (int i = 0; i < m; ++i) {
        cin >> a >> b >> c;
        g[a].emplace_back(b, c);
        g[b].emplace_back(a, c); }

    dijkstra();
    make_dom();

    for (auto v: dom[s])
        ant = max(ant, dsiz[v]);

    cout << ant << '\n';

    return 0; }


#include <bits/stdc++.h>
using namespace std;

typedef long long i64;

const i64 INF = 0x3F3F3F3F3F3F3F3F;

const int NMAX = 2e5 + 5,
          BMAX = 1 << 17,
            LG = 17;

struct PII {
    int v, c;

    inline PII() { }
    inline PII(int _v, int _c) {
        v = _v;
        c = _c; } };

struct Nod {
    int idx, far, d;

    inline Nod() { }
    inline Nod(int _idx, int _far, int _d) {
        idx = _idx;
        far = _far;
        d = _d; }

    inline bool operator < (const Nod &arg) const {
        return (d == arg.d) ? (idx < arg.idx) : (d < arg.d); } };

int n, m, s;

vector<PII> g[NMAX];
vector<int> res[NMAX], dom[NMAX];

i64  dist[NMAX];
int   lev[NMAX], dsiz[NMAX], far[LG + 1][NMAX];
char buff[BMAX];

inline char nextch(void) {
    static int bp = BMAX;

    if (bp == BMAX) {
        fread(buff, 1, BMAX, stdin);
        bp = 0; }

    return buff[ bp++ ]; }

void get(int &arg) {
    char ch;
    do {
        ch = nextch(); }
    while (ch < '0' || ch > '9');
    arg = 0;
    do {
        arg = arg * 10 + ch - '0';
        ch = nextch(); }
    while (ch >= '0' && ch <= '9'); }

inline int lca(int a, int b) {
    if (lev[a] < lev[b])
        swap(a, b);

    for (int lg = 0; lg <= LG; ++lg)
        if ((lev[a] - lev[b]) & (1 << lg))
            a = far[lg][a];

    if (a == b) return a;

    for (int lg = LG; lg >= 0; --lg)
        if (far[lg][a] != far[lg][b]) {
            a = far[lg][a];
            b = far[lg][b]; }

    return far[0][a]; }

void r_dfs(int u, int p = 0) {
    for (auto v: res[u]) if (v != p) {
        lev[v] = lev[u] + 1;
        r_dfs(v, u); } }

void d_dfs(int u, int p = 0) {
    dsiz[u] = 1;
    for (auto v: dom[u]) if (v != p) {
        d_dfs(v, u);
        dsiz[u]+= dsiz[v]; } }

void dijkstra(void) {
    set<Nod> pq;
    Nod tp;
    int ln;

    memset(dist, 0x3F, sizeof dist);
    pq.emplace(s, 0, 0);
    dist[s] = 0LL;
    ln = n - 1;

    while (!pq.empty()) {
        tp = *pq.begin();
        pq.erase(pq.begin());

        for (auto v: g[tp.idx]) {
            if (dist[v.v] == INF) {
                pq.emplace(v.v, tp.idx, dist[tp.idx] + v.c);
                dist[v.v] = dist[tp.idx] + v.c;
                far[0][v.v] = tp.idx; }
            else if (dist[tp.idx] + v.c < dist[v.v]) {
                pq.erase(pq.find(Nod(v.v, NULL, dist[v.v])));
                pq.emplace(v.v, tp.idx, dist[tp.idx] + v.c);
                dist[v.v] = dist[tp.idx] + v.c;
                far[0][v.v] = tp.idx; } } }

    for (int u = 1; u <= n; ++u) if (u != s && dist[u] != INF)
        res[far[0][u]].push_back(u);

    for (int lg = 1; lg <= LG; ++lg)
    for (int i = 1; i <= n; ++i)
        far[lg][i] = far[lg - 1][far[lg - 1][i]];

    r_dfs(s); }

void make_dom(void) {
    int god, lc;

    for (int u = 1; u <= n; ++u) if (u != s && dist[u] != INF) {
        god = far[0][u];
        for (auto v: g[u]) if (dist[v.v] + v.c == dist[u]) {
            lc = lca(u, v.v);
            if (lev[lc] < lev[god])
                god = lc; }
        dom[god].push_back(u); }

    d_dfs(s); }

int main(void) {
    //freopen("dat.in", "r", stdin);
    int a, b, c, ant;

    ant = 0;

    get(n), get(m), get(s);
    for (int i = 0; i < m; ++i) {
        get(a), get(b), get(c);
        g[a].emplace_back(b, c);
        g[b].emplace_back(a, c); }

    dijkstra();
    make_dom();

    for (auto v: dom[s])
        ant = max(ant, dsiz[v]);

    printf("%d\n", ant);

    return 0; }


#include<stdio.h>
int main()
{
	int n,m,i,j,k,win,vot,fin,count=0;
	scanf("%d%d",&n,&m);
	int a[n];
	for(i=0;i<n;i++)a[i]=0;
	for(i=0;i<m;i++)
	{
		for(j=0;j<n;j++)
		{
			scanf("%d",&k);
			if(j==0)
			{
				vot=k;win=0;
			}
			if(k>vot)
				win=j;
		}
		a[win]++;
		if(a[win]==count&&win<fin)
		{
			fin=win;
			continue;
		}
		if(a[win]>count)
		{
			fin=win;
			count=a[win];
		}
	}
	printf("%d ",fin+1);
}


#include<stdio.h>
#include<stdlib.h>
int main()
{
	int n,m,i,j,k,win,vot,fin,count=0;
	scanf("%d%d",&n,&m);
	int *a=malloc(100*sizeof(int));
	for(i=0;i<n;i++)a[i]=0;
	for(i=0;i<m;i++)
	{
		for(j=0;j<n;j++)
		{
			scanf("%d",&k);
			if(j==0)
			{
				vot=k;win=0;
			}
			if(k>vot)
				win=j;
		}
		a[win]++;
		if(a[win]==count&&win<fin)
		{
			fin=win;
			continue;
		}
		if(a[win]>count)
		{
			fin=win;
			count=a[win];
		}
	}
	printf("%d\n",fin+1);
}


#include<stdio.h>
#include<stdlib.h>
int main()
{
	int n,m,i,j,k,win,vot,fin,count=0;
	scanf("%d%d",&n,&m);
	int *a=malloc(110*sizeof(int));
	for(i=0;i<n;i++)a[i]=0;
	for(i=0;i<m;i++)
	{
		for(j=0;j<n;j++)
		{
			scanf("%d",&k);
			if(j==0)
			{
				vot=k;win=0;
			}
			if(k>vot)
			{
				win=j;
				vot=k;
			}
		}
		a[win]++;
		if(a[win]==count&&win<fin)
		{
			fin=win;
			continue;
		}
		if(a[win]>count)
		{
			fin=win;
			count=a[win];
		}
	}
	printf("%d\n",fin+1);
	return 0;
}


#include<stdio.h>
int main()
{
	int n,m,i,j,k,win,vot,fin,count=0;
	scanf("%d%d",&n,&m);
	int a[n];
	for(i=0;i<n;i++)a[i]=0;
	for(i=0;i<m;i++)
	{
		for(j=0;j<n;j++)
		{
			scanf("%d",&k);
			if(j==0)
			{
				vot=k;win=0;
			}
			if(k>vot)
				win=j;
		}
		a[win]++;
		if(a[win]==count&&win<fin)
		{
			fin=win;
			continue;
		}
		if(a[win]>count)
		{
			fin=win;
			count=a[win];
		}
	}
	printf("%d\n",fin+1);
}


#include<stdio.h>
int main()
{
	int n,m,i,j,k,win,vot,fin,count=0;
	scanf("%d%d",&n,&m);
	int a[n];
	for(i=0;i<n;i++)a[i]=0;
	for(i=0;i<m;i++)
	{
		for(j=0;j<n;j++)
		{
			scanf("%d",&k);
			if(j==0)
			{
				vot=k;win=0;
			}
			if(k>vot)
				win=j;
		}
		a[win]++;
		if(a[win]==count&&win<fin)
		{
			fin=win;
			continue;
		}
		if(a[win]>count)
		{
			fin=win;
			count=a[win];
		}
	}
	printf("%d",fin+1);
}


#include<stdio.h>
#include<string.h>
#include<math.h>
long long int b[100000]={0};
int main()
{
    int t;
    //scanf("%d",&t);
    //while(t--)
    {
        int n,m;
        scanf("%d %d",&n,&m);
        long long int a[m][n],i,j,max=0,pos,pos1,f=0;
        for(i=0;i<m;i++)
        {
            max=0,pos=0,pos1=0,f=0;
            for(j=0;j<n;j++)
            {
                scanf("%lld",&a[i][j]);
                if(max<a[i][j])
                {
                    max=a[i][j];
                    pos=j;
                }
            }
            b[pos]++;
        }
        max=0,pos=0;
        for(i=0;i<m;i++)
        {
            if(max<b[i])
            {
                pos=i;
                max=b[i];
            }
            b[i]=0;
        }
        printf("%lld\n",pos+1);
    }
    return 0;
}


#include<stdio.h>
#include<string.h>
#include<math.h>
int main()
{
        int n,m;
        scanf("%d %d",&n,&m);
        long long int a[m][n],b[200]={0},i,j,max=0,pos,pos1,f=0;
        for(i=0;i<m;i++)
        {
            max=-1,pos=-1;
            for(j=0;j<n;j++)
            {
                scanf("%lld",&a[i][j]);
                if(max<a[i][j])
                {
                    max=a[i][j];
                    pos=j;
                }
            }
            b[pos]++;
        }
        max=-1,pos=-1;
        for(i=0;i<n;i++)
        {
            if(max<b[i])
            {
                pos=i;
                max=b[i];
            }
            //printf("%lld ",b[i]);
            b[i]=0;
        }
        printf("%lld\n",pos+1);
        return 0;
}


#include<stdio.h>
#include<string.h>
#include<math.h>
long long int b[100000]={0};
int main()
{
    int t;
    //scanf("%d",&t);
    //while(t--)
    {
        int n,m;
        scanf("%d %d",&n,&m);
        long long int a[m][n],i,j,max=0,pos,pos1,f=0;
        for(i=0;i<m;i++)
        {
            max=0,pos=0,pos1=0,f=0;
            for(j=0;j<n;j++)
            {
                scanf("%lld",&a[i][j]);
                if(max<a[i][j])
                {
                    max=a[i][j];
                    pos=j;
                }
                else if(max==a[i][j])
                {
                    pos1=j;
                    f=1;
                }
            }
            if(pos<pos1||f==0)
            {
                b[pos]++;
                //printf("a= %lld \n",pos);
            }
            else
            {
                b[pos1]++;
                //printf("b= %lld \n",pos1);
            }
        }
        max=0,pos=0;
        for(i=0;i<n;i++)
        {
            if(max<b[i])
            {
                pos=i;
                max=b[i];
            }
            b[i]=0;
        }
        printf("%lld\n",pos+1);
    }
    return 0;
}


#include<stdio.h>
#include<string.h>
#include<math.h>
long long int b[100000]={0};
int main()
{
    int t;
    //scanf("%d",&t);
    //while(t--)
    {
        int n,m;
        scanf("%d %d",&n,&m);
        long long int a[m][n],i,j,max=0,pos,pos1,f=0;
        for(i=0;i<m;i++)
        {
            max=0,pos=0,pos1=0,f=0;
            for(j=0;j<n;j++)
            {
                scanf("%lld",&a[i][j]);
                if(max<a[i][j])
                {
                    max=a[i][j];
                    pos=j;
                }
                else if(max==a[i][j])
                {
                    pos1=j;
                    f=1;
                }
            }
            if(pos<pos1||f==0)
            {
                b[pos]++;
                //printf("a= %lld \n",pos);
            }
            else
            {
                b[pos1]++;
                //printf("b= %lld \n",pos1);
            }
        }
        max=0,pos=0;
        for(i=0;i<m;i++)
        {
            if(max<b[i])
            {
                pos=i;
                max=b[i];
            }
            b[i]=0;
        }
        printf("%lld\n",pos+1);
    }
    return 0;
}


#include<stdio.h>
#include<string.h>
#include<math.h>
long long int b[100000]={0};
int main()
{
    int t;
    //scanf("%d",&t);
    //while(t--)
    {
        int n,m;
        scanf("%d %d",&n,&m);
        long long int a[m][n],i,j,max=0,pos,pos1,k=0,l=0,f=0;
        for(i=0;i<m;i++)
        {
            max=0,pos=0,pos1=0,f=0;
            for(j=0;j<n;j++)
            {
                scanf("%lld",&a[i][j]);
                if(max<a[i][j])
                {
                    max=a[i][j];
                    pos=j;
                }
                else if(max==a[i][j])
                {
                    pos1=j;
                    f=1;
                }
            }
            if(pos<pos1||f==0)
            {
                b[pos]++;
                //printf("a= %lld \n",pos);
            }
            else
            {
                b[pos1]++;
                //printf("b= %lld \n",pos1);
            }
        }
        max=0,pos=0;
        for(i=0;i<m;i++)
        {
            //printf("%lld ",b[i]);
            if(max<b[i])
            {
                pos=i;
                max=b[i];
            }
            b[i]=0;
        }
        printf("%lld\n",pos+1);
    }
    return 0;
}


#include<stdio.h>
#include<string.h>
#include<math.h>
long long int b[100000]={0};
int main()
{
    int t;
    //scanf("%d",&t);
    //while(t--)
    {
        int n,m;
        scanf("%d %d",&n,&m);
        long long int a[m][n],i,j,max=0,pos,pos1,f=0;
        for(i=0;i<m;i++)
        {
            max=0,pos=0,pos1=0,f=0;
            for(j=0;j<n;j++)
            {
                scanf("%lld",&a[i][j]);
                if(max<a[i][j])
                {
                    max=a[i][j];
                    pos=j;
                }
            }
            b[pos]++;
        }
        max=0,pos=0;
        for(i=0;i<n;i++)
        {
            if(max<b[i])
            {
                pos=i;
                max=b[i];
            }
            b[i]=0;
        }
        printf("%lld\n",pos+1);
    }
    return 0;
}


#include<stdio.h>
#include<string.h>
#include<math.h>
long long int b[100000]={0};
int main()
{
    int t;
    //scanf("%d",&t);
    //while(t--)
    {
        int n,m;
        scanf("%d %d",&n,&m);
        long long int a[m][n],i,j,max=0,pos,pos1,k=0,l=0;
        for(i=0;i<m;i++)
        {
            max=0;
            for(j=0;j<n;j++)
            {
                scanf("%lld",&a[i][j]);
                if(max<a[i][j])
                {
                    max=a[i][j];
                    pos=j;
                }
                else if(max==a[i][j])
                {
                    pos1=j;
                }
            }
            if(pos<pos1)
            {
                b[pos]++;
                //printf("%lld ",pos);
            }
            else
                b[pos1]++;
        }
        max=0,pos=0;
        for(i=0;i<m;i++)
        {
            //printf("%lld ",b[i]);
            if(max<b[i])
            {
                pos=i;
                max=b[i];
            }
            b[i]=0;
        }
        printf("%lld\n",pos+1);
    }
    return 0;
}


#include <stdio.h>
#include <stdlib.h>
int n,m;
int winner(long long int a[m][n],int y)
{
    int max=a[y][1],i,ans=1;
    for(i=2;i<=n;i++)
    {
        if(max<a[y][i])
        {
            max=a[y][i];
            ans=i;
        }
    }
    return ans;
}
    int last (int finall[])
    {
        int max=finall[1],i,ans=1;
        for(i=2;i<=n;i++)
        {
            if(max<finall[i])
            {
                max=finall[i];
                ans=i;
            }
        }
        return ans;
    }

int main()
{
    int i,j,x;
    scanf("%d%d",&n,&m);
    int finall[100]={0};
    long long int a[m][n];
    for(i=1;i<=m;i++)
    {
        for(j=1;j<=n;j++)
        {
            scanf("%I64d",&a[i][j]);
        }
        x=winner(a,i);
        finall[x]++;
    }
        printf("%d",last(finall));
    return 0;
}


#include <stdio.h>
#include <stdlib.h>
int n,m;
int winner(long long int a[m+1][n+1],int y)
{
    int max=a[y][1],i,ans=1;
    for(i=2;i<=n;i++)
    {
        if(max<a[y][i])
        {
            max=a[y][i];
            ans=i;
        }
    }
    return ans;
}
    int last (int finall[])
    {
        int max=finall[1],i,ans=1;
        for(i=2;i<=n;i++)
        {
            if(max<finall[i])
            {
                max=finall[i];
                ans=i;
            }
        }
        return ans;
    }

int main()
{
    int i,j,x;
    scanf("%d%d",&n,&m);
    int finall[100]={0};
    long long int a[m+1][n+1];
    for(i=1;i<=m;i++)
    {
        for(j=1;j<=n;j++)
        {
            scanf("%I64d",&a[i][j]);
        }
        x=winner(a,i);
        finall[x]++;
    }
        printf("%d",last(finall));
    return 0;
}


#include <stdio.h>
#include <stdlib.h>
int n,m;
int winner(long long int a[m+2][n+2],int y)
{
    int max=a[y][1],i,ans=1;
    for(i=2;i<=n;i++)
    {
        if(max<a[y][i])
        {
            max=a[y][i];
            ans=i;
        }
    }
    return ans;
}
    int last (int finall[])
    {
        int max=finall[1],i,ans=1;
        for(i=2;i<=n;i++)
        {
            if(max<finall[i])
            {
                max=finall[i];
                ans=i;
            }
        }
        return ans;
    }

int main()
{
    int i,j,x;
    scanf("%d%d",&n,&m);
    int finall[100]={0};
    long long int a[m+2][n+2];
    for(i=1;i<=m;i++)
    {
        for(j=1;j<=n;j++)
        {
            scanf("%I64d",&a[i][j]);
        }
        x=winner(a,i);
        finall[x]++;
    }
        printf("%d",last(finall));
    return 0;
}


#include <stdio.h>
#include <stdlib.h>
int n,m;
int winner(long long int a[m][n],int y)
{
    int max=a[y][1],i,ans=1;
    for(i=2;i<=n;i++)
    {
        if(max<a[y][i])
        {
            max=a[y][i];
            ans=i;
        }
    }
    return ans;
}
    int last (int finall[])
    {
        int max=finall[1],i,ans=1;
        for(i=2;i<=n;i++)
        {
            if(max<finall[i])
            {
                max=finall[i];
                ans=i;
            }
        }
        return ans;
    }

int main()
{
    int i,j,x;
    scanf("%d%d",&n,&m);
    int finall[101]={0};
    long long int a[m+1][n+1];
    for(i=1;i<=m;i++)
    {
        for(j=1;j<=n;j++)
        {
            scanf("%I64d",&a[i][j]);
        }
        x=winner(a,i);
        finall[x]++;
    }
        printf("%d",last(finall));
    return 0;
}


#include <stdio.h>
#include <stdlib.h>
int n,m;
int winner(long long int a[m+2][n+2],int y)
{
    int max=a[y][1],i,ans=1;
    for(i=2;i<=n;i++)
    {
        if(max<a[y][i])
        {
            max=a[y][i];
            ans=i;
        }
    }
    return ans;
}
    int last (int finall[])
    {
        int max=finall[1],i,ans=1;
        for(i=2;i<=n;i++)
        {
            if(max<finall[i])
            {
                max=finall[i];
                ans=i;
            }
        }
        return ans;
    }

int main()
{
    int i,j,x;
    scanf("%d%d",&n,&m);
    int finall[102]={0};
    long long int a[m+2][n+2];
    for(i=1;i<=m;i++)
    {
        for(j=1;j<=n;j++)
        {
            scanf("%I64d",&a[i][j]);
        }
        x=winner(a,i);
        finall[x]++;
    }
        printf("%d",last(finall));
    return 0;
}


#include<stdio.h>

int main()
{
    int n,m,i,j,count,max=0;

    scanf("%d %d",&n,&m);

    int elec,vote[n];

    for(i=0;i<n;i++)vote[i]=0;

    for(i=0;i<m;i++){
        max=-1;
        for(j=0;j<n;j++){
            scanf("%d",&elec);
            if(elec>max)max=elec,count=j;
        }
        vote[count]++;
    }

    for(i=0;i<n;i++){
        if(max<vote[i]){
            max=vote[i];
            count=i+1;
        }
    }

    printf("%d",count);

    return 0;
}


#include<stdio.h>

int main()
{
    int n,m,i,j,count,max=0;

    scanf("%d %d",&n,&m);

    int elec[m][n],vote[n];

    for(i=0;i<m;i++){
        for(j=0;j<n;j++){
            scanf("%d",&elec[i][j]);
        }
    }
    for(i=0;i<n;i++)vote[i]=0;
    for(i=0;i<m;i++){
        for(j=0;j<n;j++)vote[j]=vote[j]+elec[i][j];
    }

    for(i=0;i<n;i++){
        if(max<vote[i]){
            max=vote[i];
            count=i+1;
        }
    }

    printf("%d",count);

    return 0;
}


#include<stdio.h>

int main()
{
    int n,m,i,j,count,max=0;

    scanf("%d %d",&n,&m);

    int elec,vote[n];

    for(i=0;i<n;i++)vote[i]=0;

    for(i=0;i<m;i++){
        max=-1;
        for(j=0;j<n;j++){
            scanf("%d",&elec);
            if(elec>max)max=elec,count=j;
        }
        vote[count]++;
    }

    max=0;
    for(i=0;i<n;i++){
        if(max<vote[i]){
            max=vote[i];
            count=i+1;
        }
    }

    printf("%d",count);

    return 0;
}


#include <stdio.h>
#include <stdlib.h>

int main()
{
    int x[100][100];
    int s[100];
    int n,m,z,winner,max,w;
    z=0;
    winner=0;
    scanf("%d %d",&n,&m);
    int i,j;//m rows n columns
    for(i=0;i<m;i++)
        { //Reading the matrix
        for(j=0;j<n;j++)
            {
            scanf("%d",&x[i][j]);
            }
        }

    for(i=0;i<m;i++)//get the winner in every state
        {max=x[i][0];
         s[i]=0;//index of winner cand. In the state
          for(j=0;j<n;j++)
          {if( x[i][j]>max)
            { max =x[i][j];
               s[i]=j;
            }
          }
        }

for(j=0;j<n;j++)
{
    for(i=0;i<m;i++)
{
if(s[i]==j)
z=z+1;
}
if(z>winner)
{winner=z;
w=j+1;}
z=0;
}
printf("%d",w);

}


#include <stdio.h>
#include <stdlib.h>

int main()
{
    int x[100][100];
    int s[100];
    int n,m,z,winner,max,w;
    z=0;
    winner=0;
    scanf("%d %d",&n,&m);
    int i,j;//m rows n columns
    for(i=0;i<m;i++)
        { //Reading the matrix
        for(j=0;j<n;j++)
            {
            scanf("%d",&x[i][j]);
            }
        }

    for(i=0;i<m;i++)//get the winner in every state
        {max=x[i][0];
         s[i]=0;//index of winner cand. In the state
          for(j=0;j<n;j++)
          {if( x[i][j]>max)
            { max =x[i][j];
               s[i]=j;
            }
          }
        }

for(j=0;j<n;j++)
for(i=0;i<m;i++)
{
    for(i=0;i<m;i++)
{
if(s[i]==j)
z=z+1;
}
if(z>winner)
{winner=z;
w=j+1;}
z=0;
}
printf("%d",w);

}


#include <stdio.h>
#include <stdlib.h>

int main()
{
    int x[100][100];
    int s[100];
    int n,m,z,winner,max;
    z=0;
    winner=0;
    scanf("%d %d",&n,&m);
    int i,j;//m rows n columns
    for(i=0;i<m;i++){ //Reading the matrix
        for(j=0;j<n;j++){
            scanf("%d",&x[i][j]);

        }
    }

    for(i=0;i<m;i++)
      { max=x[i][0];
         s[i]=1;//index of winner cand. In the state
        for(j=0;j<n;j++)
         { if( x[i][j]>max)
            { max =x[i][j];
               s[i]=j+1;
               }
               }

               }
int w;
for(j=1;j<=n;j++)
for(i=0;i<m;i++)
{
    for(i=0;i<m;i++)
{
if(s[i]==j)
z=z+1;
}
if(z>winner)
{winner=z;
w=j;}
z=0;
}
printf("%d",w);

}


#include <stdio.h>
#include <stdlib.h>

int main()
{
    int x[100][100];
    int s[100];
    int n,m,z,winner;
    scanf("%d %d",&n,&m);
    int i,j;//m rows n columns
    for(i=0;i<m;i++){ //Reading the matrix
        for(j=0;j<n;j++){
            scanf("%d",&x[i][j]);

        }
    }

    for(i=0;i<=m;i++)
      { max=x[i][0];
         s[i]=0;
        for(j=0;j<=n;j++)
         { if( x[i][j]>max)
            { max =x[i][j];
               s[i]=j;}}}

for(i=0;i<=n;i++)
{for(j=0;j<=n;j++)
{
if(s[j]==i)
z++;
}
if(z>winner)
winner=z;
z=0;
}
printf("%d",winner);
}


#include <stdio.h>
#include <stdlib.h>

int main()
{
    int x[100][100];
    int s[100];
    int n,m,z,winner,max;
    z=0;
    winner=0;
    scanf("%d %d",&n,&m);
    int i,j;//m rows n columns
    for(i=0;i<m;i++){ //Reading the matrix
        for(j=0;j<n;j++){
            scanf("%d",&x[i][j]);

        }
    }

    for(i=0;i<m;i++)
      { max=x[i][0];
         s[i]=1;//index of winner cand. In the state
        for(j=0;j<n;j++)
         { if( x[i][j]>max)
            { max =x[i][j];
               s[i]=j+1;
               }
               }
               printf("%d\n",s[i]);
               }
int w;
for(j=1;j<=n;j++)
for(i=0;i<m;i++)
{
    for(i=0;i<m;i++)
{
if(s[i]==j)
z=z+1;
}
if(z>winner)
{winner=z;
w=j;}
z=0;
}
printf("%d",w);

}


#include <stdio.h>
#include <stdlib.h>

int main()
{
    int x[100][100];
    int s[100];
    int n,m,z,winner,max,w;
    z=0;
    winner=0;
    scanf("%d %d",&n,&m);
    int i,j;//m rows n columns
    for(i=0;i<m;i++)
        { //Reading the matrix
        for(j=0;j<n;j++)
            {
            scanf("%d",&x[i][j]);
            }
        }

    for(i=0;i<m;i++)//get the winner in every state
        {max=x[i][0];
         s[i]=1;//index of winner cand. In the state
          for(j=0;j<n;j++)
          {if( x[i][j]>max)
            { max =x[i][j];
               s[i]=j+1;
            }
          }
        }

for(j=0;j<=n;j++)
{
    for(i=0;i<m;i++)
{
if(s[i]==j)
z=z+1;
}
if(z>winner)
{winner=z;
w=j;}
z=0;
}
printf("%d",w);

}


    #include <stdio.h>
    #include <stdlib.h>

    int main()
    {
        int x[100][100];
        int s[100];
        int n,m,z,winner,max;
        z=0;
        winner=0;
        scanf("%d %d",&n,&m);
        int i,j;//m rows n columns
        for(i=0;i<m;i++){ //Reading the matrix
            for(j=0;j<n;j++){
                scanf("%d",&x[i][j]);

            }
        }

        for(i=0;i<m;i++)
          { max=x[i][0];
             s[i]=0;//index of winner cand. In the state
            for(j=0;j<n;j++)
             { if( x[i][j]>max)
                { max =x[i][j];
                   s[i]=j+1;
                   }
                   }

                   }
    int w;
    for(j=1;j<=n;j++)
    for(i=0;i<m;i++)
    {
        for(i=0;i<m;i++)
    {
    if(s[i]==j)
    z=z+1;
    }
    if(z>winner)
    {winner=z;
    w=j;}
    z=0;
    }
    printf("%d",w);

    }


#include <stdio.h>
#include <stdlib.h>

int main()
{
    int x[100][100];
    int s[100];
    int n,m,z,winner,max;
    z=0;
    winner=0;
    scanf("%d %d",&n,&m);
    int i,j;//m rows n columns
    for(i=0;i<m;i++){ //Reading the matrix
        for(j=0;j<n;j++){
            scanf("%d",&x[i][j]);

        }
    }

    for(i=0;i<m;i++)
      { max=x[i][0];
         s[i]=0;//index of winner cand. In the state
        for(j=0;j<n;j++)
         { if( x[i][j]>max)
            { max =x[i][j];
               s[i]=j;
               }
               }

               }
int w;
for(j=0;j<n;j++)

{
    for(i=0;i<m;i++)
{
if(s[i]==j)
z=z+1;
}
if(z>winner)
{winner=z;
w=j+1;}
z=0;
}
printf("%d",w);

}


#include <stdio.h>
#include <stdlib.h>

int main()
{
    int x[100][100];
    int s[100];
    int n,m,z,winner;
    scanf("%d %d",&n,&m);
    int i,j;//m rows n columns
    for(i=0;i<m;i++){ //Reading the matrix
        for(j=0;j<n;j++){
            scanf("%d",&x[i][j]);

        }
    }

    for(i=0;i<=m;i++)
      { max=x[i][0];
         s[i]=0;
        for(j=0;j<=n;j++)
         { if( x[i][j]>max)
            { max =x[i][j];
               s[i]=j;}}}

for(i=0;i<=n;i++)
{for(j=0;j<=n;j++)
{
if(s[j]=i)
z++;
}
if(z>winner)
winner=z;
z=0;
}
printf("%d",winner);
}


#include <stdio.h>
#include <stdlib.h>

int main()
{
    int x[100][100];
    int s[100];
    int n,m,z,winner,max,w;
    z=0;
    winner=0;
    scanf("%d %d",&n,&m);
    int i,j;//m rows n columns
    for(i=0;i<m;i++)
        { //Reading the matrix
        for(j=0;j<n;j++)
            {
            scanf("%d",&x[i][j]);
            }
        }

    for(i=0;i<m;i++)//get the winner in every state
        {max=x[i][0];
         s[i]=1;//index of winner cand. In the state
          for(j=0;j<n;j++)
          {if( x[i][j]>max)
            { max =x[i][j];
               s[i]=j+1;
            }
          }
        }

for(j=1;j<=n;j++)
{
    for(i=0;i<m;i++)
{
if(s[i]==j)
z=z+1;
}
if(z>winner)
{winner=z;
w=j;}
z=0;
}
printf("%d",w);

}


#include <stdio.h>
#include <stdlib.h>

int main()
{
    int x[100][100];
    int s[100];
    int n,m,z,winner,max;
    z=0;
    winner=0;
    scanf("%d %d",&n,&m);
    int i,j;//m rows n columns
    for(i=0;i<m;i++){ //Reading the matrix
        for(j=0;j<n;j++){
            scanf("%d",&x[i][j]);

        }
    }

    for(i=0;i<m;i++)
      { max=x[i][0];
         s[i]=1;//index of winner cand. In the state
        for(j=0;j<n;j++)
         { if( x[i][j]>max)
            { max =x[i][j];
               s[i]=j+1;
               }
               }

               }
int w;
for(j=1;j<=n;j++)

{
    for(i=0;i<m;i++)
{
if(s[i]==j)
z=z+1;
}
if(z>winner)
{winner=z;
w=j;}
z=0;
}
printf("%d",w);

}


#include <stdio.h>
#include <stdlib.h>

int main()
{
    int x[100][100];
    int s[100];
    int n,m,z,winner,max,w;
    z=0;
    winner=0;
    scanf("%d %d",&n,&m);
    int i,j;//m rows n columns
    for(i=0;i<m;i++)
        { //Reading the matrix
        for(j=0;j<n;j++)
            {
            scanf("%d",&x[i][j]);
            }
        }

    for(i=0;i<m;i++)//get the winner in every state
        {max=x[i][0];
         s[i]=1;//index of winner cand. In the state
          for(j=0;j<n;j++)
          {if( x[i][j]>max)
            { max =x[i][j];
               s[i]=j+1;
            }
          }
        }

for(i=0;i<m;i++)
{
    for(i=0;i<m;i++)
{
if(s[i]==j)
z=z+1;
}
if(z>winner)
{winner=z;
w=j;}
z=0;
}
printf("%d",w);

}


#include <stdio.h>
#include <stdlib.h>

int main()
{
    int x[100][100];
    int s[100];
    int n,m,z,winner;
z=0;
winner=0;
    scanf("%d %d",&n,&m);
    int i,j;//m rows n columns
    for(i=0;i<m;i++){ //Reading the matrix
        for(j=0;j<n;j++){
            scanf("%d",&x[i][j]);

        }
    }

    for(i=0;i<=m;i++)
      { max=x[i][0];
         s[i]=0;
        for(j=0;j<=n;j++)
         { if( x[i][j]>max)
            { max =x[i][j];
               s[i]=j;}}}

for(i=0;i<=n;i++)
{for(j=0;j<=n;j++)
{
if(s[j]==i)
z++;
}
if(z>winner)
winner=z;
z=0;
}
printf("%d",winner);
}


#include <stdio.h>
#include <stdlib.h>

int main()
{
    int x[100][100];
    int s[100];
    int n,m,z,winner,max;
    z=0;
    winner=0;
    scanf("%d %d",&n,&m);
    int i,j;//m rows n columns
    for(i=0;i<m;i++){ //Reading the matrix
        for(j=0;j<n;j++){
            scanf("%d",&x[i][j]);

        }
    }

    for(i=0;i<=m;i++)
      { max=x[i][0];
         s[i]=0;
        for(j=0;j<=n;j++)
         { if( x[i][j]>max)
            { max =x[i][j];
               s[i]=j;}}}

for(i=0;i<=n;i++)
{for(j=0;j<=n;j++)
{
if(s[j]==i)
z++;
}
if(z>winner)
winner=z;
z=0;
}
printf("%d",winner);
}


#include <stdio.h>
#include <stdlib.h>

int main()
{
    int x[100][100];
    int s[100];
    int n,m,z,winner,max;
    z=0;
    winner=0;
    scanf("%d %d",&n,&m);
    int i,j;//m rows n columns
    for(i=0;i<m;i++){ //Reading the matrix
        for(j=0;j<n;j++){
            scanf("%d",&x[i][j]);

        }
    }

    for(i=0;i<m;i++)
      { max=x[i][0];
         s[i]=0;//index of winner cand. In the state
        for(j=0;j<n;j++)
         { if( x[i][j]>max)
            { max =x[i][j];
               s[i]=j;}
               }
               }

for(i=0;i<m;i++)
{for(j=0;j<n;j++)
{
if(s[i]==j)
z++;
}
if(z>winner)
winner=z;

z=0;
}
printf("%d",winner);

}


#include<stdio.h>
int b[100];
int main()
{
	int n,m,i,j,q,max,max1,p,index,final;
	max1=0;
	final=0;
	index=0;
	scanf("%d %d", &n, &m);
	for(i=0;i<m;i++)
	{
		max=0;
		p=0;
		q=0;
		for(j=0;j<n;j++)
		{
			scanf("%d", &q);
			p=q;
			if(p>max)
			{
				max=p;
				index=j;
			}
		}
		b[index]++;
		if(b[index]>max1)
		{
			max1=b[index];
			final=index;
		}
	}
/*	max=0;
	p=0;
	for(i=0;i<n;i++)
	{
		p=b[i];
		if(p>max)
		{
			max=p;
			final=i;
		}
	}*/
	printf("%d\n", (final+1));
	return 0;
}


#include<stdio.h>
int b[105];
int main()
{
	int n,m,i,j,q,max,p,index,final;
	index=0;
	final=0;
	scanf("%d %d", &n, &m);
	for(i=0;i<m;i++)
	{
		max=-1;
		p=0;
		q=0;
		for(j=0;j<n;j++)
		{
			scanf("%d", &q);
			p=q;
			if(p>max)
			{
				max=p;
				index=j;
			}
		}
		b[index]++;
	}
	max=0;
	p=0;
	for(i=0;i<n;i++)
	{
		p=b[i];
		if(p>max)
		{
			max=p;
			final=i;
		}
	}
	printf("%d\n", (final+1));
	return 0;
}


#include<stdio.h>
int b[105];
int main()
{
	int n,m,i,j,q,max,max1,p,index,final;
	max1=-1;
	final=0;
	index=0;
	scanf("%d %d", &n, &m);
	for(i=0;i<m;i++)
	{
		max=-1;
		p=0;
		q=0;
		final=0;
		for(j=0;j<n;j++)
		{
			scanf("%d", &q);
			p=q;
			if(p>max)
			{
				max=p;
				index=j;
			}
		}
		b[index]++;
		if(b[index]>max1)
		{
			max1=b[index];
			final=index;
		}
	}
/*	max=0;
	p=0;
	for(i=0;i<n;i++)
	{
		p=b[i];
		if(p>max)
		{
			max=p;
			final=i;
		}
	}*/
	printf("%d\n", (final+1));
	return 0;
}


#include<stdio.h>
int b[100];
int main()
{
	int n,m,i,j,q,max,max1,p,index,final;
	max1=0;
	scanf("%d %d", &n, &m);
	for(i=0;i<m;i++)
	{
		max=0;
		p=0;
		q=0;
		for(j=0;j<n;j++)
		{
			scanf("%d", &q);
			p=q;
			if(p>max)
			{
				max=p;
				index=j;
			}
		}
		b[index]++;
		if(b[index]>max1)
		{
			max1=b[index];
			final=index;
		}
	}
/*	max=0;
	p=0;
	for(i=0;i<n;i++)
	{
		p=b[i];
		if(p>max)
		{
			max=p;
			final=i;
		}
	}*/

	printf("%d\n", (final+1));
	return 0;
}


#include<stdio.h>
int main()
{
	int n,m,i,j,a[100],b[100],max,p,index,final;
	scanf("%d %d", &n, &m);
	for(i=0;i<n;i++)
		b[i]=0;
	for(i=0;i<m;i++)
	{
		max=0;
		p=0;
		for(j=0;j<n;j++)
		{
			scanf("%d", &a[j]);
			p=a[j];
			if(p>max)
			{
				max=p;
				index=j;
			}
		}
		b[index]++;
	}
	max=0;
	p=0;
	for(i=0;i<n;i++)
	{
		p=b[i];
		if(p>max)
		{
			max=p;
			final=i;
		}
	}
	printf("%d\n", (final+1));
	return 0;
}


#include<stdio.h>
int b[100];
int main()
{
	int n,m,i,j,a[100],max,p,index,final;
	scanf("%d %d", &n, &m);
	for(i=0;i<m;i++)
	{
		max=0;
		p=0;
		for(j=0;j<n;j++)
		{
			scanf("%d", &a[j]);
			p=a[j];
			if(p>max)
			{
				max=p;
				index=j;
			}
		}
		b[index]++;
	}
	max=0;
	p=0;
	for(i=0;i<n;i++)
	{
		p=b[i];
		if(p>max)
		{
			max=p;
			final=i;
		}
	}
	printf("%d\n", (final+1));
	return 0;
}


#include<stdio.h>

int main()
{
    long long int N,M,i,j,max=0,index,temp;
    scanf("%lld %lld",&N,&M);
    long long int ans[N];
    for(i=0;i<N;i++)
        ans[i]=0;
    for(i=0;i<M;i++)
    {
        max=0;
        index=0;
        for(j=0;j<N;j++)
        {
            scanf("%lld",&temp);
            if(i==M-1 && ans[j]>max)
            {
                max=ans[j];
                index=j;
            }
        }
        ans[index]++;
    }
    max=0;
    for(i=0;i<N;i++)
    {
        if(ans[i]>max)
        {
            max=ans[i];
            index=i;
        }
    }
    printf("%lld\n",index+1);
    return 0;
}


#include<stdio.h>

int main()
{
    long long int N,M,i,j,max=0,index,temp;
    scanf("%lld %lld",&N,&M);
    int ans[N];
    for(i=0;i<N;i++)
        ans[i]=0;
    for(i=0;i<M;i++)
    {
        for(j=0;j<N;j++)
        {
            scanf("%lld",&temp);
            ans[j]+=temp;
            if(i==M-1 && ans[j]>max)
            {
                max=ans[j];
                index=j;
            }
        }
    }
    printf("%lld\n",index+1);
    return 0;
}


#include<stdio.h>

int main()
{
    long long int N,M,i,j,max=0,index,temp;
    scanf("%lld %lld",&N,&M);
    long long int ans[N];
    for(i=0;i<N;i++)
        ans[i]=0;
    for(i=0;i<M;i++)
    {
        for(j=0;j<N;j++)
        {
            scanf("%lld",&temp);
            ans[j]+=temp;
            if(i==M-1 && ans[j]>max)
            {
                max=ans[j];
                index=j;
            }
        }
    }
    printf("%lld\n",index+1);
    return 0;
}


#include<stdio.h>

int main()
{
    long long int N,M,i,j,max=0,index,temp;
    scanf("%lld %lld",&N,&M);
    long long int ans[N];
    for(i=0;i<N;i++)
        ans[i]=0;
    for(i=0;i<M;i++)
    {
        max=0;
        index=0;
        for(j=0;j<N;j++)
        {
            scanf("%lld",&temp);
            if(temp>max)
            {
                max=temp;
                index=j;
            }
        }
        ans[index]++;
    }
    max=0;
    for(i=0;i<N;i++)
    {
        if(ans[i]>max)
        {
            max=ans[i];
            index=i;
        }
    }
    printf("%lld\n",index+1);
    return 0;
}


#include<stdio.h>
int main()
{
  int n,m,i,j,c=1,x=0;
  scanf("%d%d",&n,&m);
  int a[m][n];
  for(i=0;i<m;i++)
  {
      for(j=0;j<n;j++)
      scanf("%d",&a[i][j]);
  }
  for(i=0;i<m;i++)
  {
      int max=a[i][0];
     int y=0;
      for(j=1;j<n;j++)
      {
          if(a[i][j]>max)
          {
              max=a[i][j];
          y=j;
          }
      }
      if(i==0)
      {
      x=y;
      c=y;
      }
      else
      if(x==y)
      c=y;
      else
      if(y<x)
      c=y;
      else
      c=x;
  }
  printf("%d",(c+1));
}


#include <stdio.h>

long long int large(long long int ara[],long long int n)
{
    long long int i,large=0,k=0;
    for(i=0; i<n; i++)
    {
        if(ara[i]>large)
        {
            //printf("%I64d %I64d\n",ara[i],large);
            k=0;
            large=ara[i];
            k=i+1;
        }
    }
    return k;
}
int main()

{
    long long int a=0,b=0,check=0,c=0,d=0,e=0,temp=0,n,m,i,j,l=0,ara[10000],ara2[10000];
    scanf("%I64d %I64d", &n, &m);
    for(i=0; i<m; i++)
    {
        for(j=0; j<n; j++)
        {
            scanf("%I64d", &ara[j]);
        }
        ara2[l]=large(ara,n);
        //printf("%I64d\n", ara2[l]);
        l++;
    }
    for(i=0; i<m; i++)
    {
        for(j=i+1; j<m; j++)
        {
          if(ara2[j]<=ara2[i])
          {
            temp=ara2[j];
            ara2[j]=ara2[i];
            ara2[i]=temp;
          }
        }
    }
     //for(i=0; i<m; i++)
     //{
         //printf("%I64d ",ara2[i]);
     //}
    a=ara2[1];
    for(i=0; i<m; i++)
    {
        if(ara2[i]==a)
        {
            b++;
            //check=ara2[i];
        }
        if(ara2[i]!=a)
        {
            e++;
            check=ara2[i-1];
            a=ara2[i];
            if(b>d)
            {
                if(e!=1)
                    check=ara2[i];
                d=b;
                b=0;
                //check=ara2[i];
            }
        }
    }
    printf("%I64d",check);
    return 0;
}


#include <stdio.h>
#include <string.h>

int large(int ara[],int n)
{
    int i,large=0,k=0;
    for(i=0; i<n; i++)
    {
        if(ara[i]>large)
        {
            //printf("%I64d %I64d\n",ara[i],large);
            k=0;
            large=ara[i];
            k=i;
        }
    }
    //printf("k= %I64d\n", k);
    return k;
}
int main()

{
    int ans=0,a=0,b=0,check=0,c=0,d=0,e=0,maximum=0,temp=0,n,m,i,j,l=0,ara[10000],ara2[10000],ara3[10000];
    memset(ara3,0,sizeof(ara3));
    scanf("%d %d", &n, &m);
    for(i=0; i<m; i++)
    {
        for(j=0; j<n; j++)
        {
            scanf("%d", &ara[j]);
        }
        ara2[l]=large(ara,n);
        //printf("%d\n", ara2[l]);
        ara3[ara2[l]]++;
        //printf("%I64d\n", ara2[l]);
        l++;
    }
    /*for(i=0; i<m; i++)
    {
        for(j=i+1; j<m; j++)
        {
          if(ara2[j]<=ara2[i])
          {
            temp=ara2[j];
            ara2[j]=ara2[i];
            ara2[i]=temp;
          }
        }
    }
     for(i=0; i<m; i++)
     {
         printf("%I64d ",ara2[i]);
     }
    a=ara2[0];
    for(i=0; i<m; i++)
    {
        if(ara2[i]==a)
        {
            b++;
            //check=ara2[i];
        }
        else if(ara2[i]!=a && b>d)
        {
            e++;
            check=ara2[i-1];
            a=ara2[i];
            if(b>=d)
            {
                if(e!=1)
                    check=ara2[i];
                d=b;
                b=1;
                //check=ara2[i];
            }
        }
    }
    if(e==0)
        check=ara2[0];
    printf("%I64d",check);*/
    for(i=0; i<n; i++)
    {
        //printf("%d\n",ara3[i]);
        if(ara3[i]>maximum)
        {
            maximum=ara3[i];
            ans=i+1;
        }
    }
    printf("%d",ans);
    return 0;
}


#include <stdio.h>

long long int large(long long int ara[],long long int n)
{
    long long int i,large=0,k=0;
    for(i=0; i<n; i++)
    {
        if(ara[i]>large)
        {
            //printf("%I64d %I64d\n",ara[i],large);
            k=0;
            large=ara[i];
            k=i;
        }
    }
    k=k+1;
    //printf("k= %I64d\n", k);
    return k;
}
int main()

{
    long long int a=0,b=0,check=0,c=0,d=0,e=0,temp=0,n,m,i,j,l=0,ara[10000],ara2[10000];
    scanf("%I64d %I64d", &n, &m);
    for(i=0; i<m; i++)
    {
        for(j=0; j<n; j++)
        {
            scanf("%I64d", &ara[j]);
        }
        ara2[l]=large(ara,n);
        //printf("%I64d\n", ara2[l]);
        l++;
    }
    for(i=0; i<m; i++)
    {
        for(j=i+1; j<m; j++)
        {
          if(ara2[j]<=ara2[i])
          {
            temp=ara2[j];
            ara2[j]=ara2[i];
            ara2[i]=temp;
          }
        }
    }
     /*for(i=0; i<m; i++)
     {
         printf("%I64d ",ara2[i]);
     }*/
    a=ara2[0];
    for(i=0; i<m; i++)
    {
        if(ara2[i]==a)
        {
            b++;
            //check=ara2[i];
        }
        else if(ara2[i]!=a && b>d)
        {
            e++;
            check=ara2[i-1];
            a=ara2[i];
            if(b>=d)
            {
                if(e!=1)
                    check=ara2[i];
                d=b;
                b=1;
                //check=ara2[i];
            }
        }
    }
    if(e==0)
        check=ara2[0];
    printf("%I64d",check);
    return 0;
}


#include <stdio.h>

long long int large(long long int ara[],long long int n)
{
    long long int i,large=0,k=0;
    for(i=0; i<n; i++)
    {
        if(ara[i]>large)
        {
            //printf("%I64d %I64d\n",ara[i],large);
            k=0;
            large=ara[i];
            k=i;
        }
    }
    k=k+1;
    //printf("k= %I64d\n", k);
    return k;
}
int main()

{
    long long int a=0,b=0,check=0,c=0,d=0,e=0,temp=0,n,m,i,j,l=0,ara[10000],ara2[10000];
    scanf("%I64d %I64d", &n, &m);
    for(i=0; i<m; i++)
    {
        for(j=0; j<n; j++)
        {
            scanf("%I64d", &ara[j]);
        }
        ara2[l]=large(ara,n);
        //printf("%I64d\n", ara2[l]);
        l++;
    }
    for(i=0; i<m; i++)
    {
        for(j=i+1; j<m; j++)
        {
          if(ara2[j]<=ara2[i])
          {
            temp=ara2[j];
            ara2[j]=ara2[i];
            ara2[i]=temp;
          }
        }
    }
     /*for(i=0; i<m; i++)
     {
         printf("%I64d ",ara2[i]);
     }*/
    a=ara2[0];
    for(i=0; i<m; i++)
    {
        if(ara2[i]==a)
        {
            b++;
            //check=ara2[i];
        }
        if(ara2[i]!=a)
        {
            e++;
            check=ara2[i-1];
            a=ara2[i];
            if(b>d)
            {
                if(e!=1)
                    check=ara2[i];
                d=b;
                b=0;
                //check=ara2[i];
            }
        }
    }
    if(e==0)
        check=ara2[0];
    printf("%I64d",check);
    return 0;
}


#include <stdio.h>

long long int large(long long int ara[],long long int n)
{
    long long int i,large=0,k=0;
    for(i=0; i<n; i++)
    {
        if(ara[i]>large)
        {
            //printf("%I64d %I64d\n",ara[i],large);
            k=0;
            large=ara[i];
            k=i;
        }
    }
    k=k+1;
    //printf("k= %I64d\n", k);
    return k;
}
int main()

{
    long long int a=0,b=0,check=0,c=0,d=0,e=0,temp=0,n,m,i,j,l=0,ara[10000],ara2[10000];
    scanf("%I64d %I64d", &n, &m);
    for(i=0; i<m; i++)
    {
        for(j=0; j<n; j++)
        {
            scanf("%I64d", &ara[j]);
        }
        ara2[l]=large(ara,n);
        //printf("%I64d\n", ara2[l]);
        l++;
    }
    for(i=0; i<m; i++)
    {
        for(j=i+1; j<m; j++)
        {
          if(ara2[j]<=ara2[i])
          {
            temp=ara2[j];
            ara2[j]=ara2[i];
            ara2[i]=temp;
          }
        }
    }
     /*for(i=0; i<m; i++)
     {
         printf("%I64d ",ara2[i]);
     }*/
    a=ara2[0];
    for(i=0; i<m; i++)
    {
        if(ara2[i]==a)
        {
            b++;
            //check=ara2[i];
        }
        else if(ara2[i]!=a)
        {
            e++;
            check=ara2[i-1];
            a=ara2[i];
            if(b>d)
            {
                if(e!=1)
                    check=ara2[i];
                d=b;
                b=0;
                //check=ara2[i];
            }
        }
    }
    if(e==0)
        check=ara2[0];
    printf("%I64d",check);
    return 0;
}


#include <stdio.h>

long long int large(long long int ara[],long long int n)
{
    long long int i,large=0,k=0;
    for(i=0; i<n; i++)
    {
        if(ara[i]>large)
        {
            //printf("%I64d %I64d\n",ara[i],large);
            k=0;
            large=ara[i];
            k=i;
        }
    }
    k=k+1;
    //printf("k= %I64d\n", k);
    return k;
}
int main()

{
    long long int ans=0,a=0,b=0,check=0,c=0,d=0,e=0,maximum=0,temp=0,n,m,i,j,l=0,ara[10000],ara2[10000],ara3[10000];
    memset(ara3,0,sizeof(ara3));
    scanf("%I64d %I64d", &n, &m);
    for(i=0; i<m; i++)
    {
        for(j=0; j<n; j++)
        {
            scanf("%I64d", &ara[j]);
        }
        ara2[l]=large(ara,n);
        ara3[ara2[l]]++;
        //printf("%I64d\n", ara2[l]);
        l++;
    }
    /*for(i=0; i<m; i++)
    {
        for(j=i+1; j<m; j++)
        {
          if(ara2[j]<=ara2[i])
          {
            temp=ara2[j];
            ara2[j]=ara2[i];
            ara2[i]=temp;
          }
        }
    }
     for(i=0; i<m; i++)
     {
         printf("%I64d ",ara2[i]);
     }
    a=ara2[0];
    for(i=0; i<m; i++)
    {
        if(ara2[i]==a)
        {
            b++;
            //check=ara2[i];
        }
        else if(ara2[i]!=a && b>d)
        {
            e++;
            check=ara2[i-1];
            a=ara2[i];
            if(b>=d)
            {
                if(e!=1)
                    check=ara2[i];
                d=b;
                b=1;
                //check=ara2[i];
            }
        }
    }
    if(e==0)
        check=ara2[0];
    printf("%I64d",check);*/
    for(i=1; i<m; i++)
    {
        if(ara3[i]>maximum)
        {
            maximum=ara3[i];
            ans=i;
        }
    }
    printf("%I64d",ans);
    return 0;
}


#include <stdio.h>
#include <string.h>

long long int large(long long int ara[],long long int n)
{
    long long int i,large=0,k=0;
    for(i=0; i<n; i++)
    {
        if(ara[i]>large)
        {
            //printf("%I64d %I64d\n",ara[i],large);
            k=0;
            large=ara[i];
            k=i;
        }
    }
    //printf("k= %I64d\n", k);
    return k;
}
int main()

{
    long long int ans=0,a=0,b=0,check=0,c=0,d=0,e=0,maximum=0,temp=0,n,m,i,j,l=0,ara[10000],ara2[10000],ara3[10000];
    memset(ara3,0,10000);
    scanf("%I64d %I64d", &n, &m);
    for(i=0; i<m; i++)
    {
        for(j=0; j<n; j++)
        {
            scanf("%I64d", &ara[j]);
        }
        ara2[l]=large(ara,n);
        ara3[ara2[l]]++;
        //printf("%I64d\n", ara2[l]);
        l++;
    }
    /*for(i=0; i<m; i++)
    {
        for(j=i+1; j<m; j++)
        {
          if(ara2[j]<=ara2[i])
          {
            temp=ara2[j];
            ara2[j]=ara2[i];
            ara2[i]=temp;
          }
        }
    }
     for(i=0; i<m; i++)
     {
         printf("%I64d ",ara2[i]);
     }
    a=ara2[0];
    for(i=0; i<m; i++)
    {
        if(ara2[i]==a)
        {
            b++;
            //check=ara2[i];
        }
        else if(ara2[i]!=a && b>d)
        {
            e++;
            check=ara2[i-1];
            a=ara2[i];
            if(b>=d)
            {
                if(e!=1)
                    check=ara2[i];
                d=b;
                b=1;
                //check=ara2[i];
            }
        }
    }
    if(e==0)
        check=ara2[0];
    printf("%I64d",check);*/
    for(i=0; i<m; i++)
    {
        //printf("%I64d\n",ara[i]);
        if(ara3[i]>maximum)
        {
            maximum=ara3[i];
            ans=i+1;
        }
    }
    printf("%I64d",ans);
    return 0;
}


#include <stdio.h>
#include <string.h>

long long int large(long long int ara[],long long int n)
{
    long long int i,large=0,k=0;
    for(i=0; i<n; i++)
    {
        if(ara[i]>large)
        {
            //printf("%I64d %I64d\n",ara[i],large);
            k=0;
            large=ara[i];
            k=i;
        }
    }
    //printf("k= %I64d\n", k);
    return k;
}
int main()

{
    long long int ans=0,a=0,b=0,check=0,c=0,d=0,e=0,maximum=0,temp=0,n,m,i,j,l=0,ara[10000],ara2[10000],ara3[10000];
    memset(ara3,0,10000);
    scanf("%I64d %I64d", &n, &m);
    for(i=0; i<m; i++)
    {
        for(j=0; j<n; j++)
        {
            scanf("%I64d", &ara[j]);
        }
        ara2[l]=large(ara,n);
        ara3[ara2[l]]++;
        //printf("%I64d\n", ara2[l]);
        l++;
    }
    /*for(i=0; i<m; i++)
    {
        for(j=i+1; j<m; j++)
        {
          if(ara2[j]<=ara2[i])
          {
            temp=ara2[j];
            ara2[j]=ara2[i];
            ara2[i]=temp;
          }
        }
    }
     for(i=0; i<m; i++)
     {
         printf("%I64d ",ara2[i]);
     }
    a=ara2[0];
    for(i=0; i<m; i++)
    {
        if(ara2[i]==a)
        {
            b++;
            //check=ara2[i];
        }
        else if(ara2[i]!=a && b>d)
        {
            e++;
            check=ara2[i-1];
            a=ara2[i];
            if(b>=d)
            {
                if(e!=1)
                    check=ara2[i];
                d=b;
                b=1;
                //check=ara2[i];
            }
        }
    }
    if(e==0)
        check=ara2[0];
    printf("%I64d",check);*/
    for(i=0; i<m; i++)
    {
        printf("%I64d\n",ara[i]);
        if(ara3[i]>maximum)
        {
            maximum=ara3[i];
            ans=i+1;
        }
    }
    printf("%I64d",ans);
    return 0;
}


#include <stdio.h>

long long int large(long long int ara[],long long int n)
{
    long long int i,large=0,k=0;
    for(i=0; i<n; i++)
    {
        if(ara[i]>large)
        {
            //printf("%I64d %I64d\n",ara[i],large);
            k=0;
            large=ara[i];
            k=i;
        }
    }
    k=k+1;
    //printf("k= %I64d\n", k);
    return k;
}
int main()

{
    long long int a=0,b=0,check=0,c=0,d=0,e=0,temp=0,n,m,i,j,l=0,ara[10000],ara2[10000];
    scanf("%I64d %I64d", &n, &m);
    for(i=0; i<m; i++)
    {
        for(j=0; j<n; j++)
        {
            scanf("%I64d", &ara[j]);
        }
        ara2[l]=large(ara,n);
        //printf("%I64d\n", ara2[l]);
        l++;
    }
    for(i=0; i<m; i++)
    {
        for(j=i+1; j<m; j++)
        {
          if(ara2[j]<=ara2[i])
          {
            temp=ara2[j];
            ara2[j]=ara2[i];
            ara2[i]=temp;
          }
        }
    }
     //for(i=0; i<m; i++)
     //{
         //printf("%I64d ",ara2[i]);
     //}
    a=ara2[0];
    for(i=0; i<m; i++)
    {
        if(ara2[i]==a)
        {
            b++;
            //check=ara2[i];
        }
        if(ara2[i]!=a)
        {
            e++;
            check=ara2[i-1];
            a=ara2[i];
            if(b>d)
            {
                if(e!=1)
                    check=ara2[i];
                d=b;
                b=0;
                //check=ara2[i];
            }
        }
    }
    if(e==0)
        check+=1;
    printf("%I64d",check);
    return 0;
}


#include<stdio.h>
int main()
{
    long m,a[100][100],max,kq=0,tong=0;
    float n;
    scanf("%f%ld",&n,&m);
    for (int i=1;i<=m;i++)
    {
        for (int j=1;j<=n;j++)
        {
            scanf("%ld",&a[i][j]);
        }
    }
    static int b[100];
    for (int i=1;i<=m;i++)
    {
        max=0;
        for (int j=n;j>=1;j--)
        {
            if (max<=a[i][j])
            {
                max=a[i][j];
                kq=j;
            }
        }
        b[kq]++;
    }
    for (int i=1;i<=n;i++)
    {
        if (b[i]/n>=0.5)
         {
            tong=i;break;
        }
    }
    if (tong==0)
    {
        printf("1");
    }
    else
    {
        printf("%d",tong);
    }
}


#include<stdio.h>
int main()
{
    long a[101][101],max,kq=0,tong=0;
    float n,m;
    scanf("%f%f",&n,&m);
    long tong1=n;
    for (int i=1;i<=m;i++)
    {
        for (int j=1;j<=n;j++)
        {
            scanf("%ld",&a[i][j]);
        }
    }
    static int b[100];
    for (int i=1;i<=m;i++)
    {
        max=0;
        for (int j=n;j>=1;j--)
        {
            if (max<=a[i][j])
            {
                max=a[i][j];
                kq=j;
            }
        }
        b[kq]++;
        if (b[kq]/m>=1/n)
        {
            if (kq<=tong1)
            {
                tong=kq;
                tong1=kq;
            }
        }
    }
    printf("%d ",tong);
}


#include<stdio.h>
int main()
{
    long a[100][100],max,kq=0,tong=0;
    float n,m;
    scanf("%f%f",&n,&m);
    long tong1=n;
    for (int i=1;i<=m;i++)
    {
        for (int j=1;j<=n;j++)
        {
            scanf("%ld",&a[i][j]);
        }
    }
    static int b[100];
    for (int i=1;i<=m;i++)
    {
        max=0;
        for (int j=n;j>=1;j--)
        {
            if (max<=a[i][j])
            {
                max=a[i][j];
                kq=j;
            }
        }
        b[kq]++;
        if (b[kq]/m>=1/n)
        {
            if (kq<=tong1)
            {
                tong=kq;
                tong1=kq;
            }
        }
    }
    printf("%d ",tong);
}


#include<stdio.h>
int main()
{
    long m,a[100][100],max,kq=0,tong=0;
    float n;
    scanf("%f%ld",&n,&m);
    for (int i=1;i<=m;i++)
    {
        for (int j=1;j<=n;j++)
        {
            scanf("%ld",&a[i][j]);
        }
    }
    static int b[100];
    for (int i=1;i<=m;i++)
    {
        max=0;
        for (int j=n;j>=1;j--)
        {
            if (max<=a[i][j])
            {
                max=a[i][j];
                kq=j;
            }
        }
        b[kq]++;
    }
    for (int i=1;i<=n;i++)
    {
        if (b[i]/n>=1/n)
         {
            tong=i;break;
        }
    }
    printf("%d",tong);
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll MOD=1e9+7;
typedef struct
{
    ll mat[20][20];
}matrix;

matrix matrix_mul(matrix a,matrix b,ll y)
{
    matrix c;
    memset(c.mat,0,sizeof(c.mat));
    for(ll i=0;i<=y;i++)
    {
        for(ll j=0;j<=1;j++)
        {
            for(ll k=0;k<=y;k++)
            {
                c.mat[i][j]+=(a.mat[i][k]%MOD*b.mat[k][j]%MOD)%MOD;
                c.mat[i][j]%=MOD;
            }
        }
    }
    return c;
}

matrix matrix_quick_power(matrix a,ll k ,ll y)
{
    matrix b;
    memset(b.mat,0,sizeof(b.mat));
    for(int i=0;i<=15;i++)
        b.mat[i][i]=1;
    while(k)
    {
        if(k%2==1)  b=matrix_mul(b,a,y);
        k=k/2;
        a=matrix_mul(a,a,y);
    }
    return b;

}

matrix a,b,c;
int main(void)
{
    ll n,k;
    cin >> n >>k;
    memset(a.mat,0,sizeof(a.mat));
    for(int i=0;i<=15;i++)
        for(int j=i-1;j<=i-1+2;j++)
            if(j>=0 && j<=15)
                a.mat[i][j]=1;
    /*for(int i=0;i<=15;i++)
    {
        for(int j=0;j<=15;j++)
            printf("%d ",a.mat[i][j]);
        puts("");
    }*/
    c.mat[0][0]=1;
    for(int i=1;i<=n;i++)
    {
        ll  l,r,y;
        scanf("%lld%lld%lld",&l,&r,&y);
        if(r>k)  r=k;
        for(int i=y+1;i<=18;i++)    c.mat[0][i]=0;
        b=matrix_quick_power(a,r-l,y);
        c=matrix_mul(b,c,y);
    }
    printf("%lld\n",c.mat[0][0]%MOD);
}


#include <bits/stdc++.h>

using namespace std;

#define ll long long int

typedef vector <int> vi;
typedef pair<int,int> ii;
typedef vector <vi> vvi;
typedef vector <ll> vll;
typedef vector <bool> vb;

#define f(i,j,n) for(int i=j;i<n;i++)
#define ff(i,j,n) for(int i=j;i>=n;i--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define testcase int t; cin>>t; while(t--)

const ll mod = 1000000000LL + 7LL;

struct mx
{
    ll a[16][16];
}ans,p;

ll n,k;
ll aa[101],b[101],c[101];

mx mult(mx x,mx y)
{
    mx z;
    memset(z.a,0LL,sizeof(z.a));
    f(i,1,16)
        f(j,1,16)
            f(k,1,16)
                z.a[i][j] = (z.a[i][j] + 1LL*x.a[i][k]*y.a[k][j] ) % mod;

    return z;
}

mx mul(mx x,ll y)
{
    mx z;
    memset(z.a,0LL,sizeof(z.a));
        f(i,1,16) z.a[i][i]=1LL;
    while(y)
    {
        if(y%2LL == 1LL) z = mult(z,x);
        x = mult(x,x);
        y/=2LL;
    }
    return z;
}
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	cin>>n>>k;
	f(i,1,n+1)
	cin>>aa[i]>>b[i]>>c[i];

	memset(ans.a,0LL,sizeof(ans.a));

	f(i,1,16) ans.a[i][i]=1LL;

	f(i,1,n+1)
	{
	    memset(p.a,0LL,sizeof(p.a));
	    //cout<<c[i]<<" ";
	    f(j,1LL,c[i]+2LL)
	        f(k,1LL,c[i]+2LL)
	            {
	                if(labs(j-k) <= 1LL) p.a[j][k]=1LL;
	                //if(i==1)
	                //cout<<j<<" "<<k<<"\n";
	            }
	   //cout<<p.a[1][1]<<" ";
	   if(i==n)
	   p = mul(p,k-aa[i]);
	   else
	   p = mul(p,b[i]-aa[i]);

	   ans = mult(p,ans);

	}
	cout<<ans.a[1][1];
  	return 0;
}