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;
const int MAXV = 410;
const int MAXE = 2020;
const int INF = (int)1e9 + 10;
struct E {
  int to, co;
  E(int t = 0, int c = 0) : to(t), co(c) {}
} eg[2 * MAXE];
struct Flow {
  vector<int> e[MAXV];
  bool used[MAXV];
  int ei, v;
  void init(int n) {
    v = n;
    ei = 0;
    for (int i = 0; i < n; i++) e[i] = vector<int>();
  }
  void add(int a, int b, int c) {
    eg[ei] = E(b, c);
    e[a].push_back(ei);
    ei++;
    eg[ei] = E(a, 0);
    e[b].push_back(ei);
    ei++;
  }
  int d[MAXV], qu[MAXV], ql, qr;
  bool BFS(int s, int t) {
    memset(d, -1, v * sizeof(int));
    ql = qr = 0;
    qu[qr++] = s;
    d[s] = 0;
    while (ql < qr && d[t] == -1) {
      int n = qu[ql++];
      vector<int> &v = e[n];
      for (int i = v.size() - 1; i >= 0; i--) {
        int u = v[i];
        if (d[eg[u].to] == -1 && eg[u].co > 0) {
          d[eg[u].to] = d[n] + 1;
          qu[qr++] = eg[u].to;
        }
      }
    }
    return d[t] != -1;
  }
  int ptr[MAXV];
  int go(int n, int p, int t) {
    if (n == t) return p;
    vector<int> &u = e[n];
    int temp;
    for (int i = ptr[n]; i < ((int)(u).size()); i++) {
      if (d[n] + 1 != d[eg[u[i]].to] || eg[u[i]].co == 0) continue;
      if ((temp = go(eg[u[i]].to, min(p, eg[u[i]].co), t)) == 0) continue;
      eg[u[i]].co -= temp;
      eg[u[i] ^ 1].co += temp;
      ptr[n] = i;
      return temp;
    }
    ptr[n] = ((int)(u).size());
    return 0;
  }
  void dfs(int u) {
    used[u] = true;
    for (int i : e[u]) {
      if (!used[eg[i].to] && eg[i].co) dfs(eg[i].to);
    }
  }
  int max_flow(int s, int t) {
    int ans = 0, temp;
    while (BFS(s, t)) {
      for (int i = 0; i < v; i++) ptr[i] = 0;
      while ((temp = go(s, INF, t)) > 0) ans += temp;
    }
    memset(used, 0, sizeof(used));
    dfs(s);
    return ans;
  }
} flow;
struct Edge {
  int from, to, cost;
  Edge(int a, int b, int c) : from(a), to(b), cost(c) {}
};
vector<Edge> es;
int p[MAXV];
void init(int n) {
  flow.init(n);
  for (Edge tmp : es) {
    int a = tmp.from, b = tmp.to, c = tmp.cost;
    flow.add(a, b, c);
    flow.add(b, a, c);
  }
}
vector<int> vec;
int e[MAXV][MAXV];
void dfs(int u, int p, int n, vector<int> &V) {
  V.push_back(u);
  for (int v = 0; v < n; v++) {
    if (e[u][v] >= 0 && v != p) {
      dfs(v, u, n, V);
    }
  }
}
void solve(int n, vector<int> &V) {
  int k = ((int)(V).size());
  for (int i = 0; i < k; i++) (void)0;
  (void)0;
  if (k == 1) {
    vec.push_back(V[0]);
    return;
  }
  int mn = INF, a = -1, b = -1;
  for (int i = 0; i < k; i++) {
    for (int j = i + 1; j < k; j++) {
      int u = V[i], v = V[j];
      if (e[u][v] >= 0 && e[u][v] < mn) {
        mn = e[u][v];
        a = u;
        b = v;
      }
    }
  }
  e[a][b] = e[b][a] = -1;
  vector<int> V1, V2;
  dfs(a, -1, n, V1);
  dfs(b, -1, n, V2);
  solve(n, V1);
  solve(n, V2);
}
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  flow.init(n);
  for (int i = 0; i < m; i++) {
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);
    a--;
    b--;
    es.push_back(Edge(a, b, c));
  }
  fill(p, p + n, 0);
  fill(e[0], e[n], -1);
  int ans = 0;
  for (int i = 1; i < n; i++) {
    init(n);
    int tmp = flow.max_flow(i, p[i]);
    ans += tmp;
    e[i][p[i]] = e[p[i]][i] = tmp;
    for (int j = i + 1; j < n; j++) {
      if (flow.used[j] && p[i] == p[j]) p[j] = i;
    }
  }
  vector<int> V;
  for (int i = 0; i < n; i++) V.push_back(i);
  solve(n, V);
  printf("%d\n", ans);
  for (int i = 0; i < ((int)(vec).size()); i++)
    printf("%d%c", vec[i] + 1, " \n"[i == ((int)(vec).size()) - 1]);
  return 0;
}