# include <iostream>
# include <algorithm>
#include <array>
# include <cassert>
#include <cctype>
#include <climits>
#include <numeric>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
#include <stdio.h>
#include<time.h>
#include <stdlib.h>
#include <cstdint>
#include <cfenv>
#include<fstream>
//#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
long long MOD = 1000000000 + 7;
constexpr long long INF = numeric_limits<LL>::max();
const double PI = acos(-1);
#define fir first
#define sec second
#define thi third
#define debug(x) cerr<<#x<<": "<<x<<'\n'
typedef pair<LL, LL> Pll;
typedef pair<LL, pair<LL, LL>> Ppll;
typedef pair<LL, pair<LL, bitset<100001>>> Pbll;
typedef pair<LL, pair<LL, vector<LL>>> Pvll;
typedef pair<LL, LL> Vec2;
struct Tll { LL first, second, third; };
struct Fll { LL first, second, third, fourd; };
typedef pair<LL, Tll> Ptll;
#define rep(i,rept) for(LL i=0;i<rept;i++)
#define Mfor(i,mf) for(LL i=mf-1;i>=0;i--)

LL h, w, n, m, k, t, s, p, q, last, cnt, ans, sum,dp[100][100], a[2], b[20000];
string str, ss;
bool f[1100];
char c;
int di[4][2] = { { 0,1 },{ 1,0 },{ 0,-1 },{ -1,0 } };
struct Edge { LL to, cost; };
struct Head { LL head, tail, s[4]; };
vector<LL>vec[110000];
vector<vector<Head>>head[110000];
vector<Pll>v[110000];
map<string, LL>ma;
multiset<LL>st;
void YN(bool f) {
	if (f)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}
void yn(bool f) {
	if (f)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}
struct LowLink {
	int n;
	vector<vector<int>> G;
	vector<pair<int, int> > bridge;
	vector<int> articulation;
	vector<int> ord, low;
	vector<bool> vis;
	LowLink(int _n) :n(_n) {
		G.resize(_n);
		ord.resize(_n);
		low.resize(_n);
		vis.resize(_n);
	}
	void add_Edge(int x, int y) {
		G[x].push_back(y);
		G[y].push_back(x);
	}
	void build() {
		int k = 0;
		for (int i = 0; i < n; i++) {
			if (!vis[i]) dfs(i, -1, k);
		}

		sort(bridge.begin(), bridge.end());
		sort(articulation.begin(), articulation.end());

		
	}

	void dfs(int v, int p, int &k)
	{
		vis[v] = true;

		ord[v] = k++;
		low[v] = ord[v];

		bool isArticulation = false;
		int ct = 0;

		for (int i = 0; i < G[v].size(); i++) {
			if (!vis[G[v][i]]) {
				ct++;
				dfs(G[v][i], v, k);
				low[v] = min(low[v], low[G[v][i]]);
				if (~p && ord[v] <= low[G[v][i]]) isArticulation = true;
				if (ord[v] < low[G[v][i]]) bridge.push_back(make_pair(min(v, G[v][i]), max(v, G[v][i])));
			}
			else if (G[v][i] != p) {
				low[v] = min(low[v], ord[G[v][i]]);
			}
		}
		if (p == -1 && ct > 1) isArticulation = true;
		if (isArticulation) articulation.push_back(v);
	}
	void print() {
		cout << "関節点の個数" << endl;
		cout << articulation.size() <<"個"<< endl;
		for (int i = 0; i < articulation.size(); i++)
			cout << articulation[i] << endl;
		cout << "橋の個数" << endl;
		cout << bridge.size() <<"個"<< endl;
		for (int i = 0; i < bridge.size(); i++)
			cout << bridge[i].first<<"-"<<bridge[i].second << endl;
	}
};
int main() {

	cin >> n >> m;
	LowLink loli(n);
	for (int i = 0; i < m; i++) {
		int x, y;
		cin >> x >> y;
		loli.add_Edge(x, y);
	}
	loli.build();
	for (int i = 0; i < loli.bridge.size(); i++)
		cout << loli.bridge[i].first << " " <<loli.bridge[i].second << endl;
	return (0);
}


Measured memory_bytes: 12472