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;
int N, M;
int S, T, pt, ans, w;
int mn[205][205];
int f[205][205], g[205][205];
int dis[205], sum[205];
int vis[205];
int q[205], tmd;
vector<int> all, out;
bool build(int S) {
  int h = 0, t = 1, i;
  q[1] = S;
  for (i = 1; i <= N; i++) dis[i] = -1;
  dis[S] = 0;
  while (h < t) {
    int x = q[++h];
    for (i = 1; i <= N; i++)
      if (f[x][i]) {
        int y = i;
        if (dis[y] < 0) dis[y] = dis[x] + 1, q[++t] = y;
        if (y == T) return 1;
      }
  }
  return 0;
}
int dinic(int x, int low) {
  if (x == T) return low;
  int w = 0, res, i;
  for (i = 1; i <= N; i++)
    if (f[x][i]) {
      int y = i;
      if (dis[y] == dis[x] + 1 && (res = dinic(y, min(low - w, f[x][i]))))
        f[x][i] -= res, f[i][x] += res, w += res;
    }
  if (!w) dis[x] = -1;
  return w;
}
void Query(int x, int fr) {
  int i, f1 = 0, r1 = 0;
  memset(dis, 0, sizeof(dis));
  q[++r1] = x, dis[x] = 1;
  while (f1 < r1) {
    x = q[++f1];
    for (i = 1; i <= N; i++)
      if (!dis[i] && f[x][i] && f[i][x]) {
        dis[i] = 1;
        q[++r1] = i;
      }
  }
}
void Work(vector<int> poly) {
  if (poly.size() < 2) return;
  int i, j, tmp, get = 0;
  int fr, to;
  vector<int> x, y;
  x.clear(), y.clear();
  memcpy(f, g, sizeof(f));
  memset(dis, 0, sizeof(dis));
  memset(sum, 0, sizeof(sum));
  pt = sum[0] = N;
  S = poly[0], T = poly[1];
  memset(vis, 0, sizeof(vis));
  while (build(S)) get += dinic(S, 0x7fffffff);
  for (i = 1; i <= N; i++) vis[i] = (dis[i] < 0);
  for (i = 1; i <= N; i++)
    if (vis[i])
      x.push_back(i);
    else
      y.push_back(i);
  for (i = 0; i < x.size(); i++)
    for (j = 0; j < y.size(); j++)
      mn[x[i]][y[j]] = mn[y[j]][x[i]] = min(mn[x[i]][y[j]], get);
  x.clear(), y.clear();
  for (i = 0; i < poly.size(); i++)
    if (vis[poly[i]])
      x.push_back(poly[i]);
    else
      y.push_back(poly[i]);
  Work(x), Work(y);
}
void Dfs(vector<int> all) {
  if (all.size() < 2) {
    out.push_back(all[0]);
    return;
  }
  int i, tmp, best = 0x7fffffff, get = 0;
  vector<int> x, y;
  x.clear(), y.clear();
  memset(vis, 0, sizeof(vis));
  T = all[all.size() - 1];
  for (i = 0; i < all.size() - 1; i++)
    if (mn[all[i]][T] < best) S = all[i], best = mn[S][T];
  memcpy(f, g, sizeof(f));
  memset(dis, 0, sizeof(dis)), memset(sum, 0, sizeof(sum));
  pt = sum[0] = N;
  memset(vis, 0, sizeof(vis));
  while (build(S)) get += dinic(S, 0x7fffffff);
  for (i = 1; i <= N; i++) vis[i] = (dis[i] < 0);
  ans += get;
  for (i = 0; i < all.size(); i++)
    if (vis[all[i]])
      x.push_back(all[i]);
    else
      y.push_back(all[i]);
  Dfs(x), Dfs(y);
}
int main() {
  int i, j;
  int fr, to, dts, get;
  srand(time(0));
  scanf("%d %d", &N, &M);
  for (i = 1; i <= M; i++) {
    scanf("%d %d %d", &fr, &to, &dts);
    f[fr][to] += dts, f[to][fr] += dts;
  }
  memcpy(g, f, sizeof(g));
  for (i = 1; i <= N; i++)
    for (j = 1; j <= N; j++) mn[i][j] = 0x7fffffff;
  for (i = 1; i <= N; i++) all.push_back(i);
  random_shuffle(all.begin(), all.end());
  memset(mn, 63, sizeof(mn));
  Work(all);
  Dfs(all);
  printf("%d\n", ans);
  for (i = 1; i <= N; i++) printf("%d%c", out[i - 1], (i == N) ? '\n' : ' ');
  return 0;
}