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;
template <typename T>
T MAX(T a, T b) {
  return (a > b) ? a : b;
}
template <typename T>
T MIN(T a, T b) {
  return (a < b) ? a : b;
}
template <typename T>
void UMAX(T &a, T b) {
  a = (a > b ? a : b);
}
template <typename T>
void UMIN(T &a, T b) {
  a = (a < b ? a : b);
}
int readint() {
  char c = getchar();
  int ret = 0;
  while (!(c >= '0' && c <= '9')) c = getchar();
  while (c >= '0' && c <= '9') {
    ret = ret * 10 + c - '0';
    c = getchar();
  }
  return ret;
}
void putint(int v) {
  if (!v) {
    putchar('0');
    return;
  }
  if (v >= 10) putint(v / 10);
  putchar('0' + (v % 10));
}
vector<int> prt1;
bool inprt1[205];
namespace mincut {
const int inf = (int)1e9;
int S, T;
struct edge {
  int v, r;
  long long f;
  void set(int V, int R, long long F) {
    v = V;
    r = R;
    f = F;
  }
};
vector<edge> adj[205];
int cur[205], dis[205];
void init() {
  int i;
  for (i = 0; i < 205; ++i) adj[i].clear();
}
void addedge(int u, int v, long long f) {
  edge T;
  T.set(v, (int)adj[v].size(), f);
  adj[u].push_back(T);
  T.set(u, (int)adj[u].size() - 1, f);
  adj[v].push_back(T);
}
void bfs() {
  queue<int> Q;
  Q.push(S);
  dis[S] = 0;
  while (!Q.empty()) {
    int i, cv = Q.front();
    Q.pop();
    for (i = 0; i < (int)adj[cv].size(); ++i) {
      if (adj[cv][i].f > 0LL && dis[adj[cv][i].v] == -1) {
        dis[adj[cv][i].v] = dis[cv] + 1;
        Q.push(adj[cv][i].v);
      }
    }
  }
}
long long dfs(int ver, long long cap) {
  if (ver == T) return cap;
  int i;
  for (i = cur[ver]; i < (int)adj[ver].size(); ++i) {
    cur[ver] = i;
    edge &E = adj[ver][i];
    if (E.f > 0LL && dis[E.v] > dis[ver]) {
      long long ret = dfs(E.v, MIN(cap, E.f));
      if (ret > 0LL) {
        E.f -= ret;
        adj[E.v][E.r].f += ret;
        return ret;
      }
    }
  }
  return 0LL;
}
long long maxflow() {
  long long ret = 0LL, dlt;
  while (1) {
    memset(dis, -1, sizeof(dis));
    memset(cur, 0, sizeof(cur));
    bfs();
    if (dis[T] == -1) return ret;
    dlt = 1LL;
    while (dlt) {
      dlt = dfs(S, inf * 2LL);
      ret += dlt;
    }
  }
}
void dfs2(int v) {
  int i;
  prt1.push_back(v);
  inprt1[v] = 1;
  for (i = 0; i < (int)adj[v].size(); ++i) {
    if (adj[v][i].f && !inprt1[adj[v][i].v]) {
      dfs2(adj[v][i].v);
    }
  }
}
void getprt1() {
  memset(inprt1, 0, sizeof(inprt1));
  prt1.clear();
  dfs2(S);
}
};  // namespace mincut
int n, m, q, w[205][205], md[205][205], res;
vector<pair<int, pair<int, int> > > ght;
void go(vector<int> cur) {
  if ((int)cur.size() <= 1) return;
  int i, j, k;
  mincut::init();
  mincut::S = cur[0];
  mincut::T = cur[1];
  for (i = 0; i < n; ++i) {
    for (j = i + 1; j < n; ++j) {
      if (w[i][j]) mincut::addedge(i, j, w[i][j]);
    }
  }
  int cw = mincut::maxflow();
  res += cw;
  ght.push_back(make_pair(cw, make_pair(cur[0], cur[1])));
  mincut::getprt1();
  vector<int> A, B;
  for (i = 0; i < (int)cur.size(); ++i) {
    if (!inprt1[cur[i]])
      B.push_back(cur[i]);
    else
      A.push_back(cur[i]);
  }
  go(A);
  go(B);
}
int front[205], rear[205], nx[205];
namespace DSU {
int fa[205];
void init() {
  int i;
  for (i = 0; i < 205; ++i) fa[i] = i;
}
int anc(int x) { return fa[x] == x ? x : fa[x] = anc(fa[x]); }
void unite(int x, int y) { fa[anc(x)] = anc(y); }
}  // namespace DSU
int main() {
  int i, j, k;
  n = readint();
  m = readint();
  for (i = 0; i < m; ++i) {
    int u = readint() - 1, v = readint() - 1, cw = readint();
    w[u][v] += cw;
    w[v][u] += cw;
  }
  vector<int> vset;
  for (i = 0; i < n; ++i) vset.push_back(i);
  go(vset);
  printf("%d\n", res);
  DSU::init();
  for (i = 0; i < n; ++i) front[i] = rear[i] = i;
  sort(ght.begin(), ght.end());
  for (i = (int)ght.size() - 1; i >= 0; --i) {
    int x = ght[i].second.first, y = ght[i].second.second;
    x = DSU::anc(x);
    y = DSU::anc(y);
    nx[front[x]] = rear[y];
    DSU::unite(y, x);
    front[x] = front[y];
  }
  for (i = rear[DSU::anc(0)];; i = nx[i]) {
    printf("%d ", i + 1);
    if (i == front[DSU::anc(0)]) break;
  }
  printf("\n");
  return 0;
}