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;
inline int read() {
  int x = 0;
  char c = getchar();
  bool flag = 0;
  while (c < '0' || c > '9') {
    if (c == '-') flag = 1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = (x << 3) + (x << 1) + c - '0';
    c = getchar();
  }
  return flag ? -x : x;
}
void write(int x) {
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  if (x > 9) write(x / 10);
  putchar(x % 10 + '0');
  return;
}
const int maxn = 2000;
int n, m;
int ans, S, T, pl;
bool vis[maxn];
namespace network_flow {
struct edge {
  int v, w, fail;
} e[maxn * 5];
int head[maxn];
int dep[maxn];
int len = 1;
void add(int a, int b, int c) {
  len++;
  e[len].v = b;
  e[len].fail = head[a];
  e[len].w = c;
  head[a] = len;
  len++;
  e[len].v = a;
  e[len].fail = head[b];
  e[len].w = 0;
  head[b] = len;
}
bool bfs(int s, int t) {
  memset(dep, 0, sizeof(dep));
  dep[s] = 1;
  queue<int> q;
  q.push(s);
  while (!q.empty()) {
    s = q.front();
    q.pop();
    for (int i = head[s]; i; i = e[i].fail) {
      int v = e[i].v;
      if (!dep[v] && e[i].w) {
        dep[v] = dep[s] + 1;
        q.push(v);
      }
    }
  }
  return dep[t] != 0;
}
int dfs(int now, int t, int f) {
  if (now == t) return f;
  int k, res = f;
  for (int i = head[now]; i; i = e[i].fail) {
    int v = e[i].v;
    if (dep[v] == dep[now] + 1 && e[i].w) {
      k = dfs(v, t, min(res, e[i].w));
      res -= k;
      e[i].w -= k;
      e[i ^ 1].w += k;
      if (k == 0) dep[v] = 0;
      if (res == 0) break;
    }
  }
  return f - res;
}
void init() {
  for (int i = 2; i <= len; i += 2) {
    e[i].w = e[i].w + e[i ^ 1].w;
    e[i ^ 1].w = 0;
  }
}
int dinic(int s, int t) {
  init();
  int flow = 0, x = 0;
  while (bfs(s, t)) {
    while (x = dfs(s, t, 2147483646)) flow += x;
  }
  return flow;
}
}  // namespace network_flow
namespace mincuttree {
struct edge {
  int v, w, fail;
} e[maxn * 5];
int head[maxn];
int len = 1;
void add(int a, int b, int c) {
  len++;
  e[len].v = b;
  e[len].fail = head[a];
  e[len].w = c;
  head[a] = len;
  len++;
  e[len].v = a;
  e[len].fail = head[b];
  e[len].w = c;
  head[b] = len;
}
int node[maxn];
int t1[maxn], t2[maxn];
int log, dep[maxn];
int fa[maxn][20];
int Min[maxn][20];
void build(int l, int r) {
  if (l == r) return;
  int s = node[l];
  int t = node[l + 1];
  int flow = network_flow::dinic(s, t);
  add(s, t, flow);
  int cnt1, cnt2;
  cnt1 = cnt2 = 0;
  for (int i = l; i <= r; i++) {
    if (network_flow::dep[node[i]] != 0)
      t1[++cnt1] = node[i];
    else
      t2[++cnt2] = node[i];
  }
  for (int i = l; i <= l + cnt1 - 1; i++) node[i] = t1[i - l + 1];
  for (int i = l + cnt1; i <= r; i++) node[i] = t2[i - cnt1 - l + 1];
  build(l, l + cnt1 - 1);
  build(l + cnt1, r);
}
void dfs(int x, int f) {
  dep[x] = dep[f] + 1;
  for (int i = 1; i <= log; i++) {
    fa[x][i] = fa[fa[x][i - 1]][i - 1];
    Min[x][i] = min(Min[x][i - 1], Min[fa[x][i - 1]][i - 1]);
  }
  for (int i = head[x]; i; i = e[i].fail) {
    int v = e[i].v;
    if (v == f) continue;
    fa[v][0] = x;
    Min[v][0] = e[i].w;
    dfs(v, x);
  }
}
void init() {
  log = log2(n) + 1;
  for (int i = 1; i <= n; i++) node[i] = i;
  build(1, n);
  dfs(1, 0);
}
bool Dfs(int x, int f) {
  int flag = 0;
  for (int i = head[x]; i; i = e[i].fail) {
    if (e[i].v == f || vis[i]) continue;
    if (e[i].w < ans) {
      ans = e[i].w;
      S = x;
      pl = i;
      T = e[i].v;
    }
    Dfs(e[i].v, x);
    flag = 1;
  }
  return flag;
}
}  // namespace mincuttree
int tot, Ans[101000], cnt;
void query(int now) {
  int x, y;
  ans = (int)2e9;
  if (mincuttree::Dfs(now, -1) == 0) {
    Ans[++cnt] = now;
    return;
  }
  vis[pl] = 1;
  vis[pl ^ 1] = 1;
  x = S;
  y = T;
  tot += ans;
  query(x);
  query(y);
}
int main() {
  int a, b, c;
  n = read();
  m = read();
  for (int i = 1; i <= m; i++) {
    cin >> a >> b >> c;
    network_flow::add(a, b, c);
    network_flow::add(b, a, c);
  }
  mincuttree::init();
  query(1);
  cout << tot << endl;
  for (int i = 1; i <= cnt; i++) cout << Ans[i] << " ";
  cout << endl;
  return 0;
}