#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define srep(i,s,t) for(int i=(int)(s);i<(int)(t);++i)
#define each(a,b) for(auto (a): (b))
#define all(v) (v).begin(),(v).end()
#define len(v) (int)(v).size()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define cmx(x,y) x=max(x,y)
#define cmn(x,y) x=min(x,y)
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define spair(p) cout<<#p<<": "<<p.fi<<" "<<p.se<<endl
#define svec(v) cout<<#v<<":";rep(kbrni,v.size())cout<<" "<<v[kbrni];cout<<endl
#define sset(s) cout<<#s<<":";each(kbrni,s)cout<<" "<<kbrni;cout<<endl
#define smap(m) cout<<#m<<":";each(kbrni,m)cout<<" {"<<kbrni.first<<":"<<kbrni.second<<"}";cout<<endl

using namespace std;

typedef pair<int,int> P;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<P> vp;
typedef vector<string> vs;

const int MAX_N = 100005;

class biconnected{
public:
	vector<vector<int> > G ,graph;
	vector<int> ord,low,cmp;
	vector<P> bridge;
	vector<vector<P> > check;
	vector<bool> visit;
	int V;
	biconnected(int node_size){
		V = node_size;
		G.resize(V);
		check.resize(V),ord.resize(V),low.resize(V);
		cmp.resize(V),check.resize(V),visit.resize(V,false);
	}
	void build(){
		int id = 0;
		rep(i,V){
			if(!visit[i]){
				dfs(i,-1,id);
			}
		}
	}
	void dfs(int v,int p,int &k)
	{
		visit[v] = true;
		ord[v] = k++;
		low[v] = ord[v];
		for(int i = 0;i < (int)G[v].size();i++){
			int w = G[v][i];
			if(!visit[w]){
				dfs(w,v,k);
				low[v] = min(low[v],low[w]);
				if(ord[v] < low[w]){
					bridge.push_back(P(min(v,w),max(v,w)));
	                check[v][i].second = 1;
	                check[w][check[v][i].first].second = 1;
				}
			//(v,w)????????????
			}else if(w != p){
				low[v] = min(low[v],ord[w]);
			}
		}
	}

	void add_edge(int u,int v)
	{
	    G[u].push_back(v),G[v].push_back(u);
	    check[u].push_back(P((int)check[v].size(),0));
	    check[v].push_back(P((int)check[u].size()-1,0));
	}

	void restrict_dfs(int u,int p,int kind,queue<int>& que)
	{
	    visit[u] = true;
	    cmp[u] = kind;
	    rep(i,(int)G[u].size()){
			int w = G[u][i];
	        if(check[u][i].second){
	            if(!visit[w]){
	                que.push(w);
	            }
	        }else if(!visit[w]){
	            restrict_dfs(w,u,kind,que);
	        }
	    }
	}
	//????????°?????????
	int make_bcgraph()
	{
		graph.resize(V);
	    int num = 0;
	    rep(i,V){
	        if(!visit[i]){
	            dfs(i,-1,num);
	        }
	    }
	    fill(visit.begin(),visit.end(),false);
	    int kind = 0;
	    rep(i,V){
	        if(!visit[i]){
	            queue<int> que;
	            que.push(i);
	            while(!que.empty()){
	                int p = que.front();
	                que.pop();
	                restrict_dfs(p,-1,kind,que);
	                kind++;
	            }
	        }
	    }
	    rep(i,(int)bridge.size()){
	        int a = cmp[bridge[i].first];
	        int b = cmp[bridge[i].second];
	        graph[a].push_back(b), graph[b].push_back(a);
	    }
	    return kind;
	}
};

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,m;
    cin >> n >> m;
	biconnected bc(n);
	rep(i,m){
		int u,v;
		cin >> u >> v;
		bc.add_edge(u,v);
	}
	bc.build();
	sort(all(bc.bridge));
	rep(i,len(bc.bridge)){
		cout << bc.bridge[i].fi << " " << bc.bridge[i].se << "\n";
	}
    return 0;
}

Measured memory_bytes: 5916