Problem: Mad scientist Mike has applied for a job. His task is to manage a system of water pumping stations.

The system consists of n pumping stations, which are numbered by integers from 1 to n. Some pairs of stations are connected by bidirectional pipes through which water can flow in either direction (but only in one at a time). For each pipe you know its bandwidth — the maximum number of liters of water that can flow through it in one hour. Each pumping station can pump incoming water from some stations to other stations through the pipes, provided that in one hour the total influx of water to the station is equal to the total outflux of water from the station.

It is Mike's responsibility to pump water between stations. From station a to station b through the pipes (possibly through other stations) within one hour one can transmit a certain number of liters of water according to the rules described above. During this time, water from other stations can not flow into station a, and can not flow out of the station b. However, any amount of water can flow out of station a or in station b. If a total of x litres of water flows out of the station a in an hour, then Mike gets x bollars more to his salary.

To get paid, Mike needs to work for n - 1 days, according to the contract. On the first day he selects two stations v1 and v2, and within one hour he pumps a certain amount of water from v1 to v2. Next, on the i-th day Mike chooses a station vi + 1 that has been never selected before, and pumps a certain amount of water out of the station vi to station vi + 1 for one hour. The quantity of water he pumps on the i-th day does not depend on the amount of water pumped on the (i - 1)-th day.

Mike needs to earn as much bollars as he can for his projects. Help Mike find such a permutation of station numbers v1, v2, ..., vn so Mike will be able to earn the highest possible salary.

Input

The first line of the input contains two space-separated integers n and m (2 ≤ n ≤ 200, 1 ≤ m ≤ 1000) — the number of stations and pipes in the system, accordingly. The i-th of the next m lines contains three space-separated integers ai, bi and ci (1 ≤ ai, bi ≤ n, ai ≠ bi, 1 ≤ ci ≤ 100) — the numbers of stations connected by the i-th pipe and the pipe's bandwidth, accordingly. It is guaranteed that any two stations are connected by at most one pipe and that there is a pipe path between any two stations.

Output

On the first line print a single integer — the maximum salary Mike can earn.

On the second line print a space-separated permutation of n numbers from 1 to n — the numbers of stations in the sequence v1, v2, ..., vn. If there are multiple answers, print any of them.

Examples

Input

6 11
1 2 10
1 6 8
2 3 4
2 5 2
2 6 3
3 4 5
3 5 4
3 6 2
4 5 7
4 6 2
5 6 3


Output

77
6 2 1 5 3 4 

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
template <class T>
void debug(T a, T b) {
  for (; a != b; ++a) cerr << *a << ' ';
  cerr << endl;
}
template <class T>
void chmin(T& a, const T& b) {
  if (a > b) a = b;
}
template <class T>
void chmax(T& a, const T& b) {
  if (a < b) a = b;
}
namespace std {
template <class S, class T>
ostream& operator<<(ostream& out, const pair<S, T>& a) {
  out << '(' << a.first << ',' << a.second << ')';
  return out;
}
}  // namespace std
const int INF = 5e8;
struct Dinic {
  struct edge {
    int to, cap, rev;
    edge(int st, int second, int sr) {
      to = st;
      cap = second;
      rev = sr;
    }
  };
  static const int MAX_SIZE = 210;
  vector<edge> g[MAX_SIZE];
  int SS, TT;
  int rankk[MAX_SIZE], seen[MAX_SIZE];
  int src, sink;
  void init() {
    for (int i = 0; i < (MAX_SIZE); ++i) g[i].clear();
  }
  void add_edge(int from, int to, int cap) {
    g[from].push_back(edge(to, cap, g[to].size()));
    g[to].push_back(edge(from, 0, g[from].size() - 1));
  }
  void add_edge(int from, int to, int mncap, int cap) {
    add_edge(from, to, cap - mncap);
    add_edge(SS, to, mncap);
    add_edge(from, TT, mncap);
  }
  void bfs(int v) {
    memset(rankk, -1, sizeof(rankk));
    rankk[v] = 0;
    queue<int> q;
    q.push(v);
    while (!q.empty()) {
      int cur = q.front();
      q.pop();
      for (int i = 0; i < (g[cur].size()); ++i) {
        edge& e = g[cur][i];
        if (e.cap > 0 && rankk[e.to] == -1) {
          rankk[e.to] = rankk[cur] + 1;
          q.push(e.to);
        }
      }
    }
  }
  int dfs(int v, int f) {
    if (v == sink) return f;
    for (int& i = seen[v]; i < g[v].size(); ++i) {
      edge& e = g[v][i];
      if (e.cap > 0 && rankk[e.to] > rankk[v]) {
        int d = dfs(e.to, min(e.cap, f));
        if (d > 0) {
          e.cap -= d;
          g[e.to][e.rev].cap += d;
          return d;
        }
      }
    }
    return 0;
  }
  int flow_() {
    int flow = 0;
    while (1) {
      bfs(src);
      if (rankk[sink] == -1) return flow;
      int f;
      memset(seen, 0, sizeof(seen));
      while ((f = dfs(src, INF)) > 0) {
        flow += f;
      }
    }
  }
  int flow(int S_, int T_) {
    src = S_;
    sink = T_;
    return flow_();
  }
  int flow2(int S_, int T_) {
    src = SS;
    sink = TT;
    add_edge(T_, S_, INF);
    flow_();
    for (auto e : g[SS])
      if (e.cap > 0) return -1;
    src = S_;
    sink = T_;
    return flow_();
  }
  vector<bool> getcut(int S, int T, int n, int& fl) {
    fl = flow(S, T);
    vector<bool> res(n);
    for (int i = 0; i < (n); ++i) res[i] = (rankk[i] == -1 ? 1 : 0);
    return res;
  }
};
struct gomTree {
  static const int MAXN = 205;
  vector<int> vs[MAXN];
  Dinic D;
  void addE(int a, int b, int c) {
    D.add_edge(a, b, c);
    D.add_edge(b, a, c);
  }
  vector<pair<int, pair<int, int> > > getTree(
      vector<pair<int, pair<int, int> > > es, int n) {
    int m = 1;
    vector<pair<int, pair<int, int> > > res;
    for (int i = 0; i < (MAXN); ++i) vs[i].clear();
    for (int i = 0; i < (n); ++i) vs[0].push_back(i);
    for (int i = 0; i < n; ++i) {
      while (vs[i].size() > 1) {
        D.init();
        for (int j = 0; j < (i); ++j)
          for (int k = 0; k < (vs[j].size() - 1); ++k)
            addE(vs[j][k], vs[j][k + 1], INF);
        for (auto e : es) addE(e.second.first, e.second.second, e.first);
        for (auto e : res)
          if (e.second.first != i && e.second.second != i)
            addE(vs[e.second.first][0], vs[e.second.second][0], INF);
        int S = vs[i][0], T = vs[i][1];
        int F;
        vector<bool> cut = D.getcut(S, T, n, F);
        vector<int> vs1, vs2;
        for (auto v : vs[i]) {
          if (cut[v])
            vs2.push_back(v);
          else
            vs1.push_back(v);
        }
        for (auto& e : res) {
          if (e.second.second == i) swap(e.second.second, e.second.first);
          if (e.second.first == i && cut[vs[e.second.second][0]] == 1)
            e.second.first = m;
        }
        res.push_back({F, {i, m}});
        vs[i] = vs1;
        vs[m++] = vs2;
      }
    }
    for (auto& e : res) {
      e.second.first = vs[e.second.first][0];
      e.second.second = vs[e.second.second][0];
    }
    return res;
  }
};
gomTree gom;
int n, m;
vector<pair<int, pair<int, int> > > es;
vector<pair<int, int> > g[205];
int main() {
  cin >> n >> m;
  for (int i = 0; i < (m); ++i) {
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);
    --a;
    --b;
    es.push_back({c, {a, b}});
  }
  vector<pair<int, pair<int, int> > > es2 = gom.getTree(es, n);
  int c2 = -1, S = -1;
  for (auto e : es2) {
    int a = e.second.first, b = e.second.second, c = e.first;
    g[a].push_back({b, c});
    g[b].push_back({a, c});
    if (c2 < c) {
      c2 = c;
      S = a;
    }
  }
  int res = 0;
  for (auto e : es2) res += e.first;
  vector<int> path;
  priority_queue<pair<int, int> > pq;
  pq.push({INF, S});
  bool vis[205] = {0};
  while (!pq.empty()) {
    pair<int, int> cur = pq.top();
    pq.pop();
    int v = cur.second;
    if (vis[v]) continue;
    vis[v] = 1;
    path.push_back(v);
    for (auto e : g[v]) {
      pq.push({e.second, e.first});
    }
  }
  cout << res << endl;
  for (auto e : path) cout << e + 1 << endl;
  return 0;
}