#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<vector>
#include<queue>
using namespace std;
typedef long long ll;
const int maxn = 102;
int n,m;
struct edge{
int to,cap,next;
};
vector<edge> E;
vector<edge> bak;
int head[maxn],S,T,cur[maxn],d[maxn];
const int INF = 0x3f3f3f3f;
#define PB(x) push_back(x)
void adde(int u,int v,int c)
{
edge x = {v,c,head[u]};
bak.PB(x);
head[u] = bak.size()-1;
x = {u,0,head[v]};
bak.PB(x);
head[v] = bak.size()-1;
}
bool bfs()
{
memset(d,0,sizeof(d));
queue<int> q;
q.push(S);
d[S]=1;
while(!q.empty())
{
int u = q.front();q.pop();
for(int i=head[u];~i;i=E[i].next)
{
int v = E[i].to;
if(!d[v]&am