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>
const int N = 200;
const int inf = 1e9;
using namespace std;
struct edges {
  int u, v, w;
} edge[N + 5];
int n, m, t[N + 5], t1[N + 5], t2[N + 5], e1[N + 5], e2[N + 5], e[N + 5],
    edge_cnt, fa[N + 5], a[N + 5], ans;
namespace F {
const int N = 3e6;
const long long inf = 2e18;
struct edges {
  int to;
  long long cost;
} edge[N * 2 + 5], e[N * 2 + 5];
int nxt[N * 2 + 5], head[N + 5], edge_cnt = 1, dis[N + 5], q[N + 5], cur[N + 5],
                                 S, T;
void add_edge(int u, int v, long long w) {
  edge[++edge_cnt] = (edges){v, w};
  nxt[edge_cnt] = head[u];
  head[u] = edge_cnt;
}
void add(int u, int v, long long w) {
  add_edge(u, v, w);
  add_edge(v, u, w);
}
int bfs() {
  for (int i = 1; i <= n; i++) cur[i] = head[i], dis[i] = 0;
  int l = 1, r = 0;
  dis[S] = 1;
  q[++r] = S;
  while (l <= r) {
    int u = q[l++];
    for (int i = head[u]; i; i = nxt[i]) {
      int v = edge[i].to, w = edge[i].cost;
      if (w && !dis[v]) {
        dis[v] = dis[u] + 1;
        q[++r] = v;
      }
    }
  }
  return dis[T];
}
long long dfs(int u, long long flow) {
  if (u == T) return flow;
  long long sm = 0;
  for (int &i = cur[u]; i; i = nxt[i]) {
    int v = edge[i].to;
    long long w = edge[i].cost;
    if (dis[v] == dis[u] + 1 && w) {
      long long res = dfs(v, min(w, flow));
      edge[i].cost -= res;
      edge[i ^ 1].cost += res;
      sm += res;
      flow -= res;
      if (!flow) break;
    }
  }
  return sm;
}
void init() {
  for (int i = 2; i <= edge_cnt; i++) e[i] = edge[i];
}
void clear() {
  for (int i = 2; i <= edge_cnt; i++) edge[i] = e[i];
}
long long dinic(int s, int t) {
  S = s;
  T = t;
  clear();
  long long ans = 0;
  while (bfs()) ans += dfs(S, inf);
  return ans;
}
}  // namespace F
int find(int x) {
  if (fa[x] == x) return x;
  return fa[x] = find(fa[x]);
}
void build(int l, int r) {
  if (l >= r) return;
  int val = F::dinic(t[l], t[r]), cnt1 = 0, cnt2 = 0;
  edge[++edge_cnt] = (edges){t[l], t[r], val};
  for (int i = l; i <= r; i++)
    if (F::dis[t[i]])
      t1[++cnt1] = t[i];
    else
      t2[++cnt2] = t[i];
  for (int i = 1; i <= cnt1; i++) t[i] = t1[i];
  for (int i = 1; i <= cnt2; i++) t[i + cnt1] = t2[i];
  build(1, cnt1);
  build(cnt1 + 1, cnt2 + cnt1);
}
void solve(int l, int r, int ql, int qr) {
  if (l > r) return;
  if (l == r) {
    a[l] = t[l];
    return;
  }
  for (int i = l; i <= r; i++) fa[t[i]] = t[i];
  int mi = inf, id = 0, cnt1 = 0, cnt2 = 0, q1 = 0, q2 = 0;
  for (int i = ql; i <= qr; i++)
    if (edge[e[i]].w < mi) mi = edge[e[i]].w, id = e[i];
  ans += mi;
  for (int i = ql; i <= qr; i++)
    if (e[i] != id) fa[find(edge[e[i]].u)] = find(edge[e[i]].v);
  int x = find(edge[id].u);
  for (int i = l; i <= r; i++) {
    if (find(t[i]) == x)
      t1[++cnt1] = t[i];
    else
      t2[++cnt2] = t[i];
  }
  for (int i = ql; i <= qr; i++)
    if (e[i] != id) {
      if (find(edge[e[i]].u) == x)
        e1[++q1] = e[i];
      else
        e2[++q2] = e[i];
    }
  for (int i = 1; i <= cnt1; i++) t[i + l - 1] = t1[i];
  for (int i = 1; i <= cnt2; i++) t[l + i + cnt1 - 1] = t2[i];
  for (int i = 1; i <= q1; i++) e[i + ql - 1] = e1[i];
  for (int i = 1; i <= q2; i++) e[i + q1 + ql - 1] = e2[i];
  solve(l, l + cnt1 - 1, ql, ql + q1 - 1);
  solve(l + cnt1, r, ql + q1, ql + q1 + q2 - 1);
}
int main() {
  scanf("%d%d", &n, &m);
  int u, v, w;
  for (int i = 1; i <= m; i++) {
    scanf("%d%d%d", &u, &v, &w);
    F::add(u, v, w);
  }
  F::init();
  for (int i = 1; i <= n; i++) t[i] = i;
  build(1, n);
  for (int i = 1; i <= n; i++) t[i] = i;
  for (int i = 1; i < n; i++) e[i] = i;
  solve(1, n, 1, n - 1);
  cout << ans << endl;
  for (int i = 1; i <= n; i++) printf("%d ", a[i]);
  return 0;
}