#include<bits/stdc++.h>
struct edge
{
    int u,v;
    int w;
};
const int N=100;
std::priority_queue<std::pair<int,int>> pq;
std::vector <edge> e;
std::vector <std::vector<int>> h;
std::vector<int>dis;
std::vector<int>vis;
void rebuild(int &n)
{
    e.clear();
    h.resize(n+1);
    h.assign(n+1,std::vector<int>());
    dis.resize(n+1);
    dis.assign(n+1,FLT_MAX);
    vis.resize(n+1);
    vis.assign(n+1,0);
}
void add(int u,int v,int w)
{
    e.push_back({u,v,w});
    h[u].push_back(e.size()-1);
}
void dij(int s)
{
    int x;
    dis[s]=0;
    pq.push({0,s});
    while(pq.size())
    {
        auto p=pq.top();pq.pop();
        x=p.second;
        //cout<<"x="<<x<<endl;
        if(vis[x])continue;
        vis[x]=true;
        for(auto k : h[x])
        {
            int v=e[k].v,u=e[k].u;
            float w=e[k].w;
            if(vis[v]) return;
            if(dis[u]+w<dis[v])dis[v]=dis[u]+w;
            pq.push({-dis[v],v});
            //cout<<"pq push"<<dis[v]<<" & "<<v<<endl;
        }
    }
}
int main()
{}