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;
long long read() {
  long long x = 0;
  int f = 1;
  char ch = getchar();
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') f = -1;
  for (; isdigit(ch); ch = getchar()) x = x * 10 + (ch ^ 48);
  return x * f;
}
void print(long long x) {
  if (x < 0) putchar('-'), x = -x;
  if (x > 9) print(x / 10);
  putchar(x % 10 + '0');
}
int n, m;
struct Network_Flow {
  static const int N = 210, M = 2010;
  ;
  struct edge {
    int nxt, to;
    long long w;
  } e[M << 1];
  int head[N], cnt = 1;
  void add(int u, int v, int w = 0) {
    e[++cnt].w = w, e[cnt].to = v, e[cnt].nxt = head[u];
    head[u] = cnt;
  }
  void add_edge(int u, int v, int w = 0) { add(u, v, w), add(v, u, w * 0); };
  int cur[N];
  int S, T, dis[N];
  queue<int> q;
  bool BFS() {
    memset(dis, -1, sizeof(dis));
    q.push(S), dis[S] = 0;
    while (!q.empty()) {
      int u = q.front();
      q.pop();
      for (int i = cur[u] = head[u]; i; i = e[i].nxt) {
        int v = e[i].to;
        if (!~dis[v] && e[i].w) dis[v] = dis[u] + 1, q.push(v);
      }
    }
    return ~dis[T];
  }
  int DFS(int u, int exp) {
    if (u == T) return exp;
    int flow = 0, f;
    for (int &i = cur[u]; i; i = e[i].nxt) {
      int v = e[i].to;
      if (dis[v] == dis[u] + 1 && e[i].w) {
        f = DFS(v, min((long long)exp, e[i].w));
        flow += f, exp -= f;
        e[i].w -= f, e[i ^ 1].w += f;
        if (!exp) break;
      }
    }
    return flow;
  }
  void init() {
    for (int i = 2; i <= cnt; i += 2) e[i].w += e[i ^ 1].w, e[i ^ 1].w = 0;
  }
  int Dinic(int _S, int _T) {
    S = _S, T = _T, init();
    int maxflow = 0, f;
    while (BFS())
      while (f = DFS(S, 1061109567)) maxflow += f;
    return maxflow;
  }
} G;
struct Mincut_Tree {
  static const int N = 210, M = N;
  ;
  struct edge {
    int nxt, to;
    long long w;
  } e[M << 1];
  int head[N], cnt = 1;
  void add(int u, int v, int w = 0) {
    e[++cnt].w = w, e[cnt].to = v, e[cnt].nxt = head[u];
    head[u] = cnt;
  }
  void add_edge(int u, int v, int w = 0) { add(u, v, w), add(v, u, w * 1); };
  int node[N], tmp1[N], tmp2[N];
  void build(int l, int r) {
    if (l == r) return;
    int s = node[l], t = node[l + 1];
    int cut = G.Dinic(s, t);
    add_edge(s, t, cut);
    int cnt1 = 0, cnt2 = 0;
    for (int i = l; i <= r; i++)
      if (~G.dis[node[i]])
        tmp1[++cnt1] = node[i];
      else
        tmp2[++cnt2] = node[i];
    for (int i = l; i <= l + cnt1 - 1; i++) node[i] = tmp1[i - l + 1];
    for (int i = l + cnt1; i <= r; i++) node[i] = tmp2[i - cnt1 - l + 1];
    build(l, l + cnt1 - 1), build(l + cnt1, r);
  }
  int minpos, minn, ans;
  bool book[N << 1];
  int siz[N], a[N], tot;
  void get_min(int u, int fa) {
    siz[u] = 1;
    for (int i = head[u], v; i; i = e[i].nxt)
      if (!book[i] && (v = e[i].to) ^ fa) {
        if (e[i].w < minn) minn = e[i].w, minpos = i;
        get_min(v, u);
        siz[u] += siz[v];
      }
  }
  void solve(int u) {
    minn = 1061109567, minpos = -1, get_min(u, 0);
    if (siz[u] == 1)
      a[++tot] = u;
    else {
      book[minpos] = book[minpos ^ 1] = 1, ans += minn;
      int now = minpos;
      solve(e[now].to), solve(e[now ^ 1].to);
    }
  }
  void work() {
    for (int i = 1; i <= n; i++) node[i] = i;
    build(1, n);
    memset(book, 0, sizeof(book)), tot = 0;
    solve(1);
    print(ans), putchar('\n');
    for (int i = 1; i <= tot; i++) print(a[i]), putchar(' ');
  }
} T;
int main() {
  n = read(), m = read();
  for (int i = 1; i <= m; i++) {
    int u = read(), v = read(), w = read();
    G.add_edge(u, v, w), G.add_edge(v, u, w);
  }
  T.work();
}