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;
struct bian {
  int next, point, f;
} b[3000];
queue<int> Q;
int p[300], len, dst[300], w[300][300], sign, pd[300], n, m, A[300],
    inf = 1e8, s, t, numans, B[3000];
vector<int> ans;
void ade(int k1, int k2, int k3) {
  b[++len] = (bian){p[k1], k2, k3};
  p[k1] = len;
  B[len] = b[len].f;
}
void add(int k1, int k2, int k3) {
  ade(k1, k2, k3);
  ade(k2, k1, k3);
}
int change(int k1, int k2) {
  if (k1 == t || k2 == 0) return k2;
  int num = 0;
  for (int i = p[k1]; i != -1; i = b[i].next) {
    int j = b[i].point;
    if (b[i].f && dst[j] == dst[k1] + 1) {
      int k = change(j, min(b[i].f, k2));
      b[i].f -= k;
      b[i ^ 1].f += k;
      num += k;
      k2 -= k;
      if (k2 == 0) break;
    }
  }
  if (num == 0) dst[k1] = -1;
  return num;
}
int bfs() {
  memset(dst, 0xff, sizeof dst);
  dst[s] = 0;
  while (!Q.empty()) Q.pop();
  memset(pd, 0x00, sizeof pd);
  pd[s] = 1;
  Q.push(s);
  while (!Q.empty()) {
    int k = Q.front();
    for (int i = p[k]; i != -1; i = b[i].next) {
      int j = b[i].point;
      if (b[i].f && pd[j] == 0) {
        dst[j] = dst[k] + 1;
        pd[j] = 1;
        if (j == t) return 1;
        Q.push(j);
      }
    }
    Q.pop();
  }
  return pd[t];
}
int dinic() {
  for (int i = 0; i <= len; i++) b[i].f = B[i];
  int num = 0;
  while (bfs()) num += change(s, inf);
  return num;
}
void dfss(int k) {
  pd[k] = 1;
  for (int i = p[k]; i != -1; i = b[i].next) {
    int j = b[i].point;
    if (pd[j] == 0 && b[i].f) dfss(j);
  }
}
void dfs(int k) {
  s = 0;
  for (int i = 1; i <= n; i++)
    if (A[i] == k) {
      s = i;
      break;
    }
  t = 0;
  for (int i = s + 1; i <= n; i++)
    if (A[i] == k) {
      t = i;
      break;
    }
  if (!t) return;
  int ans = dinic();
  memset(pd, 0x00, sizeof pd);
  dfss(s);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++)
      if (pd[i] && pd[j] == 0) {
        w[i][j] = min(w[i][j], ans);
        w[j][i] = min(w[j][i], ans);
      }
  sign++;
  for (int i = 1; i <= n; i++)
    if (pd[i] && A[i] == k) A[i] = sign;
  dfs(sign);
  dfs(k);
}
void findans(vector<int> S) {
  if (S.size() == 1) {
    ans.push_back(S[0]);
    return;
  }
  int num = inf;
  for (int i = 0; i < S.size(); i++)
    for (int j = i + 1; j < S.size(); j++) num = min(w[S[i]][S[j]], num);
  memset(pd, 0x00, sizeof pd);
  Q.push(S[0]);
  pd[S[0]] = 1;
  while (!Q.empty()) {
    int k = Q.front();
    for (int i = 0; i < S.size(); i++)
      if (pd[S[i]] == 0 && w[k][S[i]] > num) {
        Q.push(S[i]);
        pd[S[i]] = 1;
      }
    Q.pop();
  }
  vector<int> S1, S2;
  for (int i = 0; i < S.size(); i++)
    if (pd[S[i]])
      S1.push_back(S[i]);
    else
      S2.push_back(S[i]);
  findans(S1);
  findans(S2);
  numans += num;
}
int main() {
  scanf("%d%d", &n, &m);
  len = -1;
  memset(p, 0xff, sizeof p);
  memset(w, 0x3f, sizeof w);
  for (int i = 1; i <= m; i++) {
    int k1, k2, k3;
    scanf("%d%d%d", &k1, &k2, &k3);
    add(k1, k2, k3);
  }
  sign = 0;
  dfs(0);
  vector<int> S;
  numans = 0;
  for (int i = 1; i <= n; i++) S.push_back(i);
  findans(S);
  cout << numans << endl;
  for (int i = 0; i < n; i++) cout << ans[i] << " ";
  cout << endl;
  return 0;
}