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;
long long gi() {
  long long ret = 0;
  char ch = getchar();
  while ((ch < '0' || ch > '9') && ch != '-') ch = getchar();
  char c = ch == '-' ? getchar() : ch;
  while (c >= '0' && c <= '9') ret = ret * 10 + c - '0', c = getchar();
  return ch == '-' ? -ret : ret;
}
const int N = 200 + 10;
const int M = 2010 + 10;
const int inf = 2147483640;
int n, m, st[N], pt[M], nxt[M], flow[M], cap[M], s, t, q[N], d[N], C[N][N],
    ent = 1;
void link(int u, int v, int fl) {
  pt[++ent] = v;
  nxt[ent] = st[u];
  st[u] = ent;
  flow[ent] = 0;
  cap[ent] = fl;
  pt[++ent] = u;
  nxt[ent] = st[v];
  st[v] = ent;
  flow[ent] = 0;
  cap[ent] = fl;
}
bool bfs() {
  memset(d, -1, sizeof(d));
  int hd = 0, tl = 0;
  q[++tl] = s;
  d[s] = 0;
  while (hd < tl) {
    int r = q[++hd];
    if (r == t) return true;
    for (int i = st[r]; i; i = nxt[i])
      if (flow[i] < cap[i] && d[pt[i]] == -1) {
        d[pt[i]] = d[r] + 1;
        q[++tl] = pt[i];
      }
  }
  return false;
}
int dfs(int x, int a) {
  if (x == t || a == 0) return a;
  int f, fl = 0;
  for (int i = st[x]; i; i = nxt[i]) {
    if (flow[i] >= cap[i] || d[pt[i]] != d[x] + 1) continue;
    if ((f = dfs(pt[i], min(a, cap[i] - flow[i]))) > 0) {
      flow[i] += f;
      flow[i ^ 1] -= f;
      a -= f;
      fl += f;
      if (!a) break;
    }
  }
  if (!fl) d[x] = -1;
  return fl;
}
int vis[N], R[N], token, cut;
void go(int x, vector<int> &s) {
  vis[x] = token;
  s.push_back(x);
  for (int i = st[x]; i; i = nxt[i]) {
    if (flow[i] >= cap[i] || vis[pt[i]] == token) continue;
    go(pt[i], s);
  }
}
void go2(int x, vector<int> &s1, vector<int> &s2) {
  vis[x] = token;
  for (int i = 0; i < s1.size(); i += 1) {
    C[s1[i]][x] = C[x][s1[i]] = min(C[s1[i]][x], cut);
  }
  s2.push_back(x);
  for (int i = st[x]; i; i = nxt[i]) {
    if (flow[i] >= cap[i] || vis[pt[i]] == token) continue;
    go2(pt[i], s1, s2);
  }
}
void solve(vector<int> S) {
  if (S.size() <= 1) return;
  s = S[0];
  t = S[1];
  for (int i = 2; i <= ent; i += 1) flow[i] = 0;
  cut = 0;
  while (bfs()) cut += dfs(s, inf);
  ++token;
  vector<int> S1, S2;
  go(s, S1);
  go2(t, S1, S2);
  for (int i = 0; i < S.size(); ++i) R[S[i]] = token;
  for (int i = 0; i < S1.size();)
    if (R[S1[i]] != token)
      swap(S1[i], S1.back()), S1.pop_back();
    else
      ++i;
  for (int i = 0; i < S2.size();)
    if (R[S2[i]] != token)
      swap(S2[i], S2.back()), S2.pop_back();
    else
      ++i;
  solve(S1);
  solve(S2);
}
struct edge {
  int u, v, w;
} e[N * N];
int tot, pa[N];
bool cmp(const edge &x, const edge &y) { return x.w > y.w; }
int find(int x) { return pa[x] == x ? x : pa[x] = find(pa[x]); }
namespace tree {
int st[N], pt[N << 1], nxt[N << 1], w[N << 1], ban[N << 1], vis[N], ent = 1;
void link(int u, int v, int _w) {
  pt[++ent] = v;
  nxt[ent] = st[u];
  st[u] = ent;
  w[ent] = _w;
  pt[++ent] = u;
  nxt[ent] = st[v];
  st[v] = ent;
  w[ent] = _w;
}
int mn, mw, u, v;
void dfs2(int x, int fa) {
  for (int i = st[x]; i; i = nxt[i]) {
    if (ban[i] || pt[i] == fa) continue;
    if (w[i] < mn) mn = w[i], mw = i, u = x, v = pt[i];
    dfs2(pt[i], x);
  }
}
void solve(int x) {
  mn = 1e9;
  mw = -1;
  dfs2(x, 0);
  if (mw == -1) return printf("%d ", x), void();
  ban[mw] = ban[mw ^ 1] = true;
  int tu = u, tv = v;
  solve(tu);
  solve(tv);
}
}  // namespace tree
int main() {
  n = gi();
  m = gi();
  int u, v, _w;
  for (int i = 1; i <= m; i += 1) {
    u = gi();
    v = gi();
    _w = gi();
    link(u, v, _w);
  }
  vector<int> S;
  for (int i = 1; i <= n; i += 1) S.push_back(i);
  memset(C, 127 / 3, sizeof(C));
  solve(S);
  for (int i = 1; i <= n; i += 1)
    for (int j = i + 1; j <= n; j += 1) e[++tot] = (edge){i, j, C[i][j]};
  sort(e + 1, e + 1 + tot, cmp);
  long long ans = 0;
  for (int i = 1; i <= n; i += 1) pa[i] = i;
  int ent = 0;
  for (int i = 1; i <= tot; i += 1) {
    u = e[i].u;
    v = e[i].v;
    _w = e[i].w;
    if (find(u) != find(v)) {
      pa[find(u)] = find(v);
      ans += _w;
      tree::link(u, v, _w);
    }
  }
  printf("%I64d\n", ans);
  tree::solve(1);
  return 0;
}