#include <LEDA/graph/graph.h>
#include <LEDA/graph/dimacs_graph.h>
#include <LEDA/system/assert.h>

using namespace leda;

using std::cout;
using std::cin;



int main(int argc, char** argv)
{
  graph G;
  node s,t;
  edge_array<int>  cap(G);

  dimacs_mf D(cin);
  D.translate(G,s,t,cap);

  list<edge> E = G.all_edges();
  E.reverse_items();
  G.sort_edges(E);

  write_dimacs_mf(cout,G,s,t,cap);

  return 0;
}

