#include <bits/stdc++.h>
#include <pthread.h>
#define ll long long
#define deb(x) cout << #x << " : " << x << endl;
#define take_input(a) \
for (auto &x : a) \
cin >> x;
#define _output(a) \
for (auto &x : a) \
cout << x << " "; \
cout << endl;
#define srt(a) sort(a.begin(), a.end())
#define nl "\n"
using namespace std;
class Graph {
private:
int V;
list<int> *adj;
bool *visited;
int *tin;
int *low;
int timer = 1;
map<pair<int, int>, int> ans;
public:
bool isPossible = true;
Graph(int n);
void addEdge(int u, int v);
void dfs(int node, int parent);
void printSol();
};
Graph::Graph(int n) {
V = n + 1;
adj = new list<int>[V];
visited = new bool[V];
tin = new int[V];
low = new int[V];
}
void Graph::addEdge(int u, int v) {
adj[u].push_back(v);
adj[v].push_back(u);
}
void Graph::dfs(int node, int parent) {
if (!isPossible)
return;
visited[node] = true;
tin[node] = timer;
low[node] = timer;
timer++;
for (auto v : adj[node]) {
if (v == parent)
continue;
if (ans.find({node, v}) == ans.end() && ans.find({v, node}) == ans.end())
ans[{node, v}] = true;
if (!visited[v]) {
dfs(v, node);
low[node] = min(low[node], low[v]);
if (tin[node] < low[v]) {
isPossible = false;
return;
}
} else {
low[node] = min(low[node], low[v]);
}
}
}
void Graph::printSol() {
for (auto i : ans) {
cout << i.first.first << " " << i.first.second << nl;
}
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int T = 1;
// cin >> T;
while (T--) {
int n, m;
cin >> n >> m;
Graph g(n);
for (int i = 0; i < m; i++) {
int u, v;
cin >> u >> v;
g.addEdge(u, v);
}
g.dfs(1, 1);
if (g.isPossible)
g.printSol();
else
cout << 0 << nl;
}
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CiNpbmNsdWRlIDxwdGhyZWFkLmg+CiNkZWZpbmUgbGwgbG9uZyBsb25nCiNkZWZpbmUgZGViKHgpIGNvdXQgPDwgI3ggPDwgIiA6ICIgPDwgeCA8PCBlbmRsOwojZGVmaW5lIHRha2VfaW5wdXQoYSkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAogIGZvciAoYXV0byAmeCA6IGEpICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAogICAgY2luID4+IHg7CiNkZWZpbmUgX291dHB1dChhKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCiAgZm9yIChhdXRvICZ4IDogYSkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCiAgICBjb3V0IDw8IHggPDwgIiAiOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCiAgY291dCA8PCBlbmRsOwojZGVmaW5lIHNydChhKSBzb3J0KGEuYmVnaW4oKSwgYS5lbmQoKSkKI2RlZmluZSBubCAiXG4iCnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgpjbGFzcyBHcmFwaCB7CnByaXZhdGU6CiAgaW50IFY7CiAgbGlzdDxpbnQ+ICphZGo7CiAgYm9vbCAqdmlzaXRlZDsKICBpbnQgKnRpbjsKICBpbnQgKmxvdzsKICBpbnQgdGltZXIgPSAxOwogIG1hcDxwYWlyPGludCwgaW50PiwgaW50PiBhbnM7CgpwdWJsaWM6CiAgYm9vbCBpc1Bvc3NpYmxlID0gdHJ1ZTsKICBHcmFwaChpbnQgbik7CiAgdm9pZCBhZGRFZGdlKGludCB1LCBpbnQgdik7CiAgdm9pZCBkZnMoaW50IG5vZGUsIGludCBwYXJlbnQpOwogIHZvaWQgcHJpbnRTb2woKTsKfTsKCkdyYXBoOjpHcmFwaChpbnQgbikgewogIFYgPSBuICsgMTsKICBhZGogPSBuZXcgbGlzdDxpbnQ+W1ZdOwogIHZpc2l0ZWQgPSBuZXcgYm9vbFtWXTsKICB0aW4gPSBuZXcgaW50W1ZdOwogIGxvdyA9IG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