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>
namespace ztd {
using namespace std;
template <typename T>
inline T read(T& t) {
  t = 0;
  short f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -f;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') t = t * 10 + ch - '0', ch = getchar();
  t *= f;
  return t;
}
}  // namespace ztd
using namespace ztd;
const int inf = 0x3f3f3f3f;
const int maxm = 1007;
const int maxn = 207;
int n, m, q;
namespace NF {
int last[maxn], dep[maxn], ecnt = 1;
struct edge {
  int y, gg, w;
} e[maxm << 2];
inline void addedge(int x, int y, int w) {
  e[++ecnt].y = y;
  e[ecnt].gg = last[x];
  e[ecnt].w = w;
  last[x] = ecnt;
  e[++ecnt].y = x;
  e[ecnt].gg = last[y];
  e[ecnt].w = 0;
  last[y] = ecnt;
}
inline bool bfs(int s, int t) {
  memset(dep, 0, sizeof(dep));
  dep[s] = 1;
  queue<int> q;
  q.push(s);
  while (!q.empty()) {
    int x = q.front();
    q.pop();
    for (int i = last[x], y; i; i = e[i].gg) {
      y = e[i].y;
      if (!dep[y] && e[i].w) {
        dep[y] = dep[x] + 1;
        q.push(y);
      }
    }
  }
  return (dep[t] != 0);
}
int dfs(int x, int t, int sum) {
  if (x == t) return sum;
  int k, rest = sum;
  for (int i = last[x], y; i; i = e[i].gg) {
    y = e[i].y;
    if (dep[y] == dep[x] + 1 && e[i].w) {
      k = dfs(y, t, min(rest, e[i].w));
      rest -= k;
      e[i].w -= k;
      e[i ^ 1].w += k;
      if (k == 0) dep[y] = 0;
      if (rest == 0) break;
    }
  }
  return sum - rest;
}
int dicnic(int s, int t) {
  for (int i = 2; i <= ecnt; i += 2) {
    e[i].w = e[i].w + e[i ^ 1].w;
    e[i ^ 1].w = 0;
  }
  int ans = 0, now = 0;
  while (bfs(s, t)) {
    while (now = dfs(s, t, inf)) ans += now;
  }
  return ans;
}
}  // namespace NF
namespace mct {
int last[maxn], ecnt = 1;
struct edge {
  int y, gg, w;
} e[maxn << 1];
inline void addedge(int x, int y, int w) {
  e[++ecnt].y = y;
  e[ecnt].w = w;
  e[ecnt].gg = last[x];
  last[x] = ecnt;
}
int node[maxn];
int g1[maxn], g2[maxn];
void build(int l, int r) {
  if (l == r) return;
  int s = node[l], t = node[l + 1];
  ;
  int cut = NF::dicnic(s, t);
  addedge(s, t, cut);
  addedge(t, s, cut);
  int n1 = 0, n2 = 0;
  for (int i = l; i <= r; ++i) {
    if (NF::dep[node[i]])
      g1[++n1] = node[i];
    else
      g2[++n2] = node[i];
  }
  for (int i = l; i <= l + n1 - 1; ++i) node[i] = g1[i - l + 1];
  for (int i = l + n1; i <= r; ++i) node[i] = g2[i - n1 - l + 1];
  build(l, l + n1 - 1);
  build(l + n1, r);
}
int log2n, dep[maxn], anc[maxn][11], minl[maxn][11];
void dfs(int x, int fa) {
  dep[x] = dep[fa] + 1;
  for (int i = 1; i <= log2n; ++i) {
    anc[x][i] = anc[anc[x][i - 1]][i - 1];
    minl[x][i] = min(minl[x][i - 1], minl[anc[x][i - 1]][i - 1]);
  }
  for (int i = last[x], y; i; i = e[i].gg) {
    y = e[i].y;
    if (y == fa) continue;
    anc[y][0] = x;
    minl[y][0] = e[i].w;
    dfs(y, x);
  }
}
inline void preprocess() {
  log2n = log2(n) + 1;
  for (int i = 1; i <= n; ++i) node[i] = i;
  build(1, n);
  dfs(1, 0);
}
int query(int x, int y) {
  int ans = inf;
  if (dep[x] < dep[y]) swap(x, y);
  for (int i = log2n; i >= 0; --i) {
    if (dep[anc[x][i]] >= dep[y]) {
      ans = min(ans, minl[x][i]);
      x = anc[x][i];
    }
  }
  if (x == y) return ans;
  for (int i = log2n; i >= 0; --i) {
    if (anc[x][i] != anc[y][i]) {
      ans = min(ans, min(minl[x][i], minl[y][i]));
      x = anc[x][i];
      y = anc[y][i];
    }
  }
  ans = min(ans, min(minl[x][0], minl[y][0]));
  return ans;
}
}  // namespace mct
int bo[maxn][maxn];
bool vis[maxn];
int sol[maxn], ro[maxn];
signed main() {
  read(n);
  read(m);
  int x, y;
  for (int i = 1, w; i <= m; ++i) {
    read(x);
    read(y);
    read(w);
    NF::addedge(x, y, w);
    NF::addedge(y, x, w);
  }
  mct::preprocess();
  for (int i = 1; i <= n; ++i) {
    for (int j = i + 1; j <= n; ++j) {
      bo[i][j] = bo[j][i] = mct::query(i, j);
    }
  }
  int ans = 0;
  for (int i = 1; i <= n; ++i) {
    memset(vis, 0, sizeof(vis));
    vis[i] = 1;
    ro[1] = i;
    int now = i, nowans = 0;
    for (int j = 2; j <= n; ++j) {
      int mx = 0, mxk;
      for (int k = 1; k <= n; ++k) {
        if (vis[k]) continue;
        if (mx < bo[now][k]) mx = bo[now][k], mxk = k;
      }
      now = mxk;
      vis[now] = 1;
      ro[j] = now;
      nowans += mx;
    }
    if (ans < nowans) {
      ans = nowans;
      for (int j = 1; j <= n; ++j) sol[j] = ro[j];
    }
  }
  cout << ans << '\n';
  for (int i = 1; i <= n; ++i) cout << sol[i] << ' ';
  cout << '\n';
  return 0;
}