#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#include <unordered_map>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) ((a) <= (x) && (x) <= (b))
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MODU 1000000007
#define bitcheck(a,b)   ((a >> b) & 1)
#define bitset(a,b)      ( a |= (1 << b))
#define bitunset(a,b)    (a &= ~(1 << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
#define pritnf printf
#define scnaf scanf
#define itn int
#define PI 3.141592653589
#define PAD(a,b) MP(((a).first + (b).first),((a).second, (b).second))

#define izryt bool

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*) array, (T*) (array + N), val);
}
pii Dir[8] = { //?§????
	{ 0, 1 }, { -1, 0 }, { 1, 0 }, { 0, -1 },
	{ 1, 1 }, { 1, -1 }, { -1, 1 }, { -1, -1 }
}; 
struct UnionFind {
	vector<int> data;
	UnionFind(int size) : data(size, -1) { }
	bool unionSet(int x, int y) { //????????\??£??????????????¨ y?????\??£?????????????????????
		x = root(x); y = root(y);
		if (x != y) {
			if (data[y] < data[x]) swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
		return x != y;
	}
	bool findSet(int x, int y) { //x??¨y????????????????????\??£??????????????????????????????
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	bool isroot(int x) {
		return data[x] < 0;
	}
	int size(int x) {
		return -data[root(x)];
	}
};

class Graph {
public:
	int vn;
	int sumcost = 0;
	vector<vector<pii>> g;

	Graph(int n) {
		vn = n;
		g.resize(n);
	}
	virtual void con(int a, int b, int w) = 0;
	int getWeight(int f, int t) {
		auto itr = lower_bound(ALL(g[f]), make_pair(t, INT_MIN));
		if (itr != g[f].end())
			return itr->second;
		return INT_MIN;
	}
	int Costsum() {
		return sumcost;
	}
};

class BiDGraph : public Graph {//??????
public:
	BiDGraph(int n) : Graph(n) {}

	void con(int a, int b, int w = 1) {
		g[a].push_back({ b, w });
		g[b].push_back({ a, w });
		sumcost++;
	}
};
class DGraph : public Graph {//??????
public:
	DGraph(int n) : Graph(n) {}
	void con(int a, int b, int w = 1) {
		g[a].push_back({ b, w });
		sumcost++;
	}
};

//Lowlink  BID
void Lowlink(BiDGraph& g, vector<int>& lowlink, DGraph& dfsg, vector<int>& orb, int st = 0) {
	orb.resize(g.vn, INT_MAX);
	lowlink.resize(g.vn, INT_MAX);
	int k = 0;
	function<void(int, int)> dfs = [&](int cur, int f) {
		int nex = 0;
		orb[cur] = k++;
		lowlink[cur] = orb[cur];
		for (auto itr : g.g[cur]) {
			if (f == itr.first) {f = -1; continue;}
			if (orb[itr.first] == INT_MAX) {
				dfs(itr.first, cur);
				lowlink[cur] = min(lowlink[cur], lowlink[itr.first]);
				dfsg.con(cur, itr.first);
			}
			else {
				lowlink[cur] = min(lowlink[cur], orb[itr.first]);
			}
		}
	};
	dfs(st, -1);
	return;
}
//Lowlink D
void Lowlink(DGraph& g, vector<int>& lowlink, DGraph& dfsg, vector<int>& orb, int st = 0) {
	orb.resize(g.vn, INT_MAX);
	lowlink.resize(g.vn, INT_MAX);
	int k = 0;
	function<void(int, int)> dfs = [&](int cur, int f) {
		int nex = 0;
		orb[cur] = k++;
		lowlink[cur] = orb[cur];
		for (auto itr : g.g[cur]) {
			if (orb[itr.first] == INT_MAX) {
				dfs(itr.first, cur);
				lowlink[cur] = min(lowlink[cur], lowlink[itr.first]);
				dfsg.con(cur, itr.first);
			}
			else {
				lowlink[cur] = min(lowlink[cur], orb[itr.first]);
			}
		}
	};
	dfs(st, -1);
	return;
}
//??¢???????????¨??????
template<typename Gtype>
void Joint(Gtype& g, vector<int>& joints, int st = 0) {
	vector<int> lowlink, orb;
	DGraph dfsg(g.vn);
	Lowlink(g, lowlink, dfsg, orb, st);

	REP(i, dfsg.vn) {
		if (st == i) continue;
		if (orb[i] == INT_MAX) continue;
		for (auto itr : dfsg.g[i]) {
			if (orb[itr.first] == INT_MAX) continue;
			if (orb[i] > orb[itr.first]) continue;

			if (orb[i] <= lowlink[itr.first]) {
				joints.push_back(i);
				break;
			}
		}
	}
	if (dfsg.g[st].size() > 1)
		joints.push_back(st);
}
template<typename Gtype>
void Bridge(Gtype& g, vector<pii>& bridges, int st = 0) {
	vector<int> lowlink, orb;
	DGraph dfsg(g.vn);
	Lowlink(g, lowlink, dfsg, orb, st);

	REP(i, dfsg.vn) {
		for (auto itr : dfsg.g[i]) {
			if (orb[i] > orb[itr.first]) continue;

			if (orb[i] < lowlink[itr.first]) {
				bridges.push_back({ i, itr.first });
			}
		}
	}
}
signed main() {
	int v, e;
	scnaf("%d %d", &v, &e);
	BiDGraph g(v);
	REP(i, e) {
		int a, b;
		scanf("%d %d", &a, &b);
		g.con(a, b);
	}
	vector<pii> bridges;
	Bridge(g, bridges);

	for (auto itr = bridges.begin(); itr != bridges.end(); itr++) {
		if (itr->first > itr->second)
			swap(itr->first, itr->second);
	}
	sort(ALL(bridges));
	for (auto itr : bridges) {
		printf("%d %d\n", itr.first, itr.second);
	}
	return 0;
}

Measured memory_bytes: 5952