#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
template<typename T>
using ordered_set=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
#define ll long long
#define ull unsigned long long
#define pi pair<ll,ll>
#define pii pair<ll,pi>
#define inf 1000000000000000000
#define iinf -1000000000000000000
#define __ ios_base::sync_with_stdio(0);cin.tie();cout.tie();
#define MOD 1000000007
#define uu first
#define vv second
#define endl '\n'
pi operator+(pi a, ll x) {return {a.uu + x, a.vv + x} ;}
pi operator- (pi a, ll x) {return {a.uu - x, a.vv - x} ;}
pi operator* (pi a, ll x) {return {a.uu * x, a.vv * x} ;}
pi operator+(pi x, pi y) { return {x.uu + y.uu,x.vv + y.vv} ;}
pi operator-(pi x,pi y) { return {x.uu - y.uu, x.vv - y.vv} ;}
pi operator*(pi x,pi y) { return {x.uu * y.uu , x.vv * y.vv} ;}
pi operator%(pi x,pi y) { return {x.uu % y.uu, x.vv % y.vv} ;}
const pi base = {103,101};
const pi mod = {1000000021, 1e9 + 9 };
ll Set(ll N,ll pos){ return N=N | (1LL<<pos); }
ll reset(ll N,ll pos){ return N= N & ~(1LL<<pos); }
bool check(ll N,ll pos){ return (bool)(N & (1LL<<pos)); }
ll ar[]={0,0,1,-1};
ll br[]={1,-1,0,0};
///*******GEOMETRY**********///
double PI=acos(-1.0);
double gcd(double a,double b){
return fabs(b)<1e-4?a:gcd(b,fmod(a,b));
}
///*******GEOMETRY**********///
ll sqrt_ (int64_t x) {
int64_t y = sqrt(x);
while (y * y > x) {
--y;
}
while (y * y <= x) {
++y;
}
return y - 1;
}
ll bigmod(ll n,ll pow){
if(pow==0) return 1;
if(pow==1) return n%MOD;
ll ans=bigmod(n,pow/2);
ans=(ans*ans)%MOD;
if(pow%2==1){ans=(ans*n)%MOD;}
return ans%MOD;
}
ll fact[1000005];
ll nCr(ll n,ll r){
ll ans=fact[n];
ans=(ans*bigmod(fact[r],MOD-2))%MOD;
ans=(ans*bigmod(fact[n-r],MOD-2))%MOD;
return ans;
}
string s,s1,s2;
ll n,m;
ll arr[5000010];
ll brr[5000010];
vector<ll>v,v1;
map<ll,ll>mp;
ll vis[5000005];
const ll N = 40005;
vector<ll>gg[N];
ll match[N], dist[N];
ll idx;
bool bfs(){
queue<ll>q;
for(ll i=1;i<=idx;i++){
if(match[i]==0){
dist[i]=0;
q.push(i);
}
else dist[i]=inf;
}
dist[0]=inf;
while(!q.empty()){
ll u=q.front();
q.pop();
if(u!=0){
for(auto v:gg[u]){
if(dist[match[v]]==inf){
dist[match[v]]=dist[u]+1;
q.push(match[v]);
}
}
}
}
return (dist[0] != inf);
}
bool dfs(ll u){
if(u!=0){
for(auto v:gg[u]){
if(dist[match[v]]==dist[u]+1){
if(dfs(match[v])){
match[v]=u;
match[u]=v;
return true;
}
}
}
dist[u]=inf;
return false;
}
return true;
}
ll max_match(){
ll matching =0;
while(bfs()){
for(ll i=1;i<=idx;i++){
if(match[i]==0&&dfs(i)) matching++;
}
}
return matching;
}
// complexity: O(sqrt(V)*E).
int main()
{__
ll i,j,a,b,c,d,e,f,g,x,y,z,t,k,l,r;
fact[0]=1;
// for(i=1;i<=1000000;i++) fact[i]=(fact[i-1]*i)%MOD;
ll ans=0,sum=0,temp;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KI2luY2x1ZGU8ZXh0L3BiX2RzL2Fzc29jX2NvbnRhaW5lci5ocHA+CiNpbmNsdWRlPGV4dC9wYl9kcy90cmVlX3BvbGljeS5ocHA+CnVzaW5nIG5hbWVzcGFjZSBfX2dudV9wYmRzOwp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKdGVtcGxhdGU8dHlwZW5hbWUgVD4KdXNpbmcgb3JkZXJlZF9zZXQ9dHJlZTxULG51bGxfdHlwZSxsZXNzPFQ+LHJiX3RyZWVfdGFnLHRyZWVfb3JkZXJfc3RhdGlzdGljc19ub2RlX3VwZGF0ZT47CgojZ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cgcyxzMSxzMjsKbGwgbixtOwpsbCBhcnJbNTAwMDAxMF07CmxsIGJycls1MDAwMDEwXTsKdmVjdG9yPGxsPnYsdjE7CgptYXA8bGwsbGw+bXA7CmxsIHZpc1s1MDAwMDA1XTsKY29uc3QgbGwgTiA9IDQwMDA1Owp2ZWN0b3I8bGw+Z2dbTl07CmxsIG1hdGNoW05dLCBkaXN0W05dOwpsbCBpZHg7CmJvb2wgYmZzKCl7CiAgICBxdWV1ZTxsbD5xOwogICAgZm9yKGxsIGk9MTtpPD1pZHg7aSsrKXsKICAgICAgICBpZihtYXRjaFtpXT09MCl7CiAgICAgICAgICAgIGRpc3RbaV09MDsKICAgICAgICAgICAgcS5wdXNoKGkpOwogICAgICAgIH0KICAgICAgICBlbHNlIGRpc3RbaV09aW5mOwogICAgfQogICAgZGlzdFswXT1pbmY7CgogICAgd2hpbGUoIXEuZW1wdHkoKSl7CiAgICAgICAgbGwgdT1xLmZyb250KCk7CiAgICAgICAgcS5wb3AoKTsKICAgICAgICBpZih1IT0wKXsKICAgICAgICAgICAgZm9yKGF1dG8gdjpnZ1t1XSl7CiAgICAgICAgICAgICAgICBpZihkaXN0W21hdGNoW3ZdXT09aW5mKXsKICAgICAgICAgICAgICAgICAgICBkaXN0W21hdGNoW3ZdXT1kaXN0W3VdKzE7CiAgICAgICAgICAgICAgICAgICAgcS5wdXNoKG1hdGNoW3ZdKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0KICAgIH0KICAgIHJldHVybiAoZGlzdFswXSAhPSBpbmYpOwp9Cgpib29sIGRmcyhsbCB1KXsKICAgIGlmKHUhPTApewogICAgICAgIGZvcihhdXRvIHY6Z2dbdV0pewogICAgICAgICAgICBpZihkaXN0W21hdGNoW3ZdXT09ZGlzdFt1XSsxKXsKICAgICAgICAgICAgICAgIGlmKGRmcyhtYXRjaFt2XSkpewogICAgICAgICAgICAgICAgICAgIG1hdGNoW3ZdPXU7CiAgICAgICAgICAgICAgICAgICAgbWF0Y2hbdV09djsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBkaXN0W3VdPWluZjsKICAgICAgICByZXR1cm4gZmFsc2U7CiAgICB9CiAgICByZXR1cm4gdHJ1ZTsKfQoKbGwgbWF4X21hdGNoKCl7CiAgICBsbCBtYXRjaGluZyA9MDsKICAgIHdoaWxlKGJmcygpKXsKICAgICAgICBmb3IobGwgaT0xO2k8PWlkeDtpKyspewogICAgICAgICAgICBpZihtYXRjaFtpXT09MCYmZGZzKGkpKSBtYXRjaGluZysrOwogICAgICAgIH0KICAgIH0KICAgIHJldHVybiBtYXRjaGluZzsKfQoKLy8gY29tcGxleGl0eTogTyhzcXJ0KFYpKkUpLgoKaW50IG1haW4oKQp7X18KICAgICAgICBsbCBpLGosYSxiLGMsZCxlLGYsZyx4LHkseix0LGssbCxyOwogICAgICAgIGZhY3RbMF09MTsKCiAgICAgIC8vICBmb3IoaT0xO2k8PTEwMDAwMDA7aSsrKSBmYWN0W2ldPShmYWN0W2ktMV0qaSklTU9EOwogICAgICAgIGxsIGFucz0wLHN1bT0wLHRlbXA7CgoKfQoKCgo=