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 ii {
  int x, y;
  ii(int x = 0, int y = 0) : x(x), y(y) {}
  bool operator<(const ii &a) const {
    if (x != a.x) return x < a.x;
    return y < a.y;
  }
  bool operator==(const ii &a) const { return x == a.x && y == a.y; }
  ii friend operator+(ii a, ii b) { return ii(a.x + b.x, a.y + b.y); }
  ii friend operator-(ii a, ii b) { return ii(a.x - b.x, a.y - b.y); }
};
template <class T>
void sc(T &x) {
  x = 0;
  char c;
  int f = 1;
  while (c = getchar(), c < 48)
    if (c == '-') f = -1;
  do x = x * 10 + (c ^ 48);
  while (c = getchar(), c > 47);
  x *= f;
}
template <class T>
void nt(T x) {
  if (!x) return;
  nt(x / 10);
  putchar(x % 10 + '0');
}
template <class T>
void pt(T x) {
  if (x < 0) putchar('-'), x = -x;
  if (!x)
    putchar('0');
  else
    nt(x);
}
template <class T>
void pts(T x) {
  pt(x);
  putchar(' ');
}
template <class T>
void ptn(T x) {
  pt(x);
  putchar('\n');
}
template <class T>
void pp(T x, int y) {
  pt(x);
  putchar(" \n	"[y]);
}
template <class T>
void PP(T *x, int y) {
  for (int i = 0, i_ = y; i < i_; ++i) pp(x[i], i == y - 1);
}
template <class T>
void Max(T &x, T y) {
  if (x < y) x = y;
}
template <class T>
void Min(T &x, T y) {
  if (x > y) x = y;
}
const int maxn = 505;
const int maxm = 2005;
int n, m;
int S, T;
int point[maxm], nextp[maxm], capa[maxm], head[maxn], work[maxn], ecnt;
void ins(int u, int v, int cap) {
  capa[ecnt] = cap;
  point[ecnt] = v;
  nextp[ecnt] = head[u];
  head[u] = ecnt++;
}
void ins2(int u, int v) {
  point[ecnt] = v;
  nextp[ecnt] = head[u];
  head[u] = ecnt++;
}
int dist[maxn], q[maxn];
int dinic_dfs(int x, int rem) {
  if (x == T) return rem;
  int res = 0, tmp;
  for (int &i = work[x]; i >= 0; i = nextp[i]) {
    int to = point[i];
    if (capa[i] > 0 && dist[to] == dist[x] + 1 &&
        (tmp = dinic_dfs(to, min(capa[i], rem)))) {
      capa[i] -= tmp;
      capa[i ^ 1] += tmp;
      rem -= tmp;
      res += tmp;
      if (!rem) break;
    }
  }
  return res;
}
bool dinic_bfs() {
  memset(dist, -1, n + 1 << 2);
  int l, r;
  l = r = 0;
  q[r++] = S;
  dist[S] = 0;
  while (l < r) {
    int x = q[l++];
    for (int i = head[x]; i >= 0; i = nextp[i]) {
      int to = point[i];
      if (capa[i] > 0 && dist[to] < 0) {
        dist[to] = dist[x] + 1;
        q[r++] = to;
      }
    }
  }
  return dist[T] >= 0;
}
int dinic_flow() {
  int res = 0;
  for (int i = 0; i < ecnt; i += 2)
    capa[i] = capa[i ^ 1] = capa[i] + capa[i ^ 1] >> 1;
  while (dinic_bfs()) {
    for (int i = 0, i_ = n; i < i_; ++i) work[i] = head[i];
    res += dinic_dfs(S, (1 << 30));
  }
  return res;
}
bool vis[maxn];
void dfs(int x) {
  vis[x] = true;
  for (int i = head[x]; i >= 0; i = nextp[i]) {
    int to = point[i];
    if (capa[i] > 0 && !vis[to]) dfs(to);
  }
}
int fa[maxn << 1];
struct Edge {
  int u, v, w;
  bool operator<(const Edge &a) const { return w > a.w; }
} e[maxn];
int get(int x) { return fa[x] == x ? x : fa[x] = get(fa[x]); }
int cnt = 0;
void dfs2(int x) {
  if (x < n) {
    pts(x + 1);
    return;
  }
  for (int i = head[x]; i >= 0; i = nextp[i]) dfs2(point[i]);
}
void build() {
  int tot = 0;
  for (int i = 1, i_ = n; i < i_; ++i) {
    S = fa[i];
    T = i;
    e[tot++] = (Edge){fa[i], i, dinic_flow()};
    memset(vis, 0, n);
    dfs(S);
    for (int j = i + 1, j_ = n; j < j_; ++j)
      if (fa[j] == S && !vis[j]) fa[j] = i;
  }
  for (int i = 0, i_ = n; i < i_; ++i) fa[i] = i;
  sort(e, e + tot);
  memset(head, -1, n + 1 << 3);
  ecnt = 0;
  int tot2 = n;
  int ans = 0;
  for (int i = 0, i_ = tot; i < i_; ++i) {
    int u = e[i].u;
    int v = e[i].v;
    int w = e[i].w;
    ans += w;
    u = get(u);
    v = get(v);
    ins2(tot2, u);
    ins2(tot2, v);
    fa[u] = fa[v] = tot2;
    fa[tot2] = tot2;
    tot2++;
  }
  assert(get(1) == tot2 - 1);
  ptn(ans);
  dfs2(get(1));
}
int main() {
  sc(n);
  sc(m);
  memset(head, -1, n + 1 << 2);
  ecnt = 0;
  for (int i = 0, i_ = m; i < i_; ++i) {
    int u, v, w;
    sc(u);
    sc(v);
    --u;
    --v;
    sc(w);
    ins(u, v, w);
    ins(v, u, w);
  }
  build();
  return 0;
}