Bertown has n junctions and m bidirectional roads. We know that one can get from any junction to any other one by the existing roads. 

As there were more and more cars in the city, traffic jams started to pose real problems. To deal with them the government decided to make the traffic one-directional on all the roads, thus easing down the traffic. Your task is to determine whether there is a way to make the traffic one-directional so that there still is the possibility to get from any junction to any other one. If the answer is positive, you should also find one of the possible ways to orient the roads.

Input

The first line contains two space-separated integers n and m (2 ≤ n ≤ 105, n - 1 ≤ m ≤ 3·105) which represent the number of junctions and the roads in the town correspondingly. Then follow m lines, each containing two numbers which describe the roads in the city. Each road is determined by two integers ai and bi (1 ≤ ai, bi ≤ n, ai ≠ bi) — the numbers of junctions it connects.

It is guaranteed that one can get from any junction to any other one along the existing bidirectional roads. Each road connects different junctions, there is no more than one road between each pair of junctions.

Output

If there's no solution, print the single number 0. Otherwise, print m lines each containing two integers pi and qi — each road's orientation. That is the traffic flow will move along a one-directional road from junction pi to junction qi. You can print the roads in any order. If there are several solutions to that problem, print any of them.

Examples

Input

6 8
1 2
2 3
1 3
4 5
4 6
5 6
2 4
3 5


Output

1 2
2 3
3 1
4 5
5 6
6 4
4 2
3 5


Input

6 7
1 2
2 3
1 3
4 5
4 6
5 6
2 4


Output

0
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Stack;
import java.util.StringTokenizer;
public class graph_representation implements Runnable{
public static int[] visited=new int[1000001];
public static int[] level=new int[1000001];
public static int[] gf=new int[20000];
public static int[] col=new int[20000];
public static int[] in=new int[1000001];
public static int[] low=new int[1000001];
static int min_dist=Integer.MAX_VALUE;
static int min_gf=Integer.MAX_VALUE;
static int timer=1;
static long count_1=0;
static int end=-1;
static int leng=0;
static boolean p=true;
public static ArrayList<Integer> e11=new ArrayList<>();
	static class FastReader 
    { 
        BufferedReader br; 
        StringTokenizer st; 
        public FastReader() 
        { 
            br = new BufferedReader(new
                     InputStreamReader(System.in)); 
        } 
        String next() 
        { 
            while (st == null || !st.hasMoreElements()) 
            { 
                try
                { 
                    st = new StringTokenizer(br.readLine()); 
                } 
                catch (IOException  e) 
                { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
        int nextInt() 
        { 
            return Integer.parseInt(next()); 
        } 
        long nextLong() 
        { 
            return Long.parseLong(next()); 
        } 
        double nextDouble() 
        { 
            return Double.parseDouble(next()); 
        } 
        String nextLine() 
        { 
            String str = ""; 
            try
            { 
                str = br.readLine(); 
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } 
            return str; 
        } 
    } 
 
public static boolean isPrime(int n) {
	for(int i=2;i*i<=n;i++) {
		if(n%i==0) {
			return false;
		}
	}
	return true;
}
public static boolean diff(int a,int b) {
	int cnt=0;
	while(a>0) {
		if(a%10!=b%10) {
			cnt++;
		}
		a/=10;
		b/=10;
	}
	if(cnt==1) {
		return true;
	}else {
		return false;
	}
}
public static void main(String[] args) throws Exception {
    new Thread(null, new graph_representation(), "Main", 1<<26).start();
  }

//ArrayList<Integer>[] b=new ArrayList[100000];
//for(int i=1000;i<=9999;i++) {
//	b[i]=new ArrayList<>();
//}
//ArrayList<Integer> primes=new ArrayList<>();
//for(int i=1000;i<=9999;i++) {
//	if(isPrime(i)) {
//		primes.add(i);
//	}
//}
//for(int i=0;i<primes.size();i++) {
//	for(int j=i+1;j<primes.size();j++) {
//		if(diff(primes.get(i),primes.get(j))) {
//			b[primes.get(i)].add(primes.get(j));
//			b[primes.get(j)].add(primes.get(i));
//		}
//	}
//}
//int t=s.nextInt();
//for(int j=1;j<=t;j++) {
//	for(int i=0;i<20000;i++) {
//		visited[i]=0;
//		col[i]=0;
//	}
//int t=s.nextInt();
//while(t>0) {
//	long count=0;
//	count_1=0;
//	for(int i=1;i<visited.length;i++) {
//		visited[i]=0;
//	}
//	long sum=1;
public void run() {
	OutputStream outputStream =System.out;
    PrintWriter out =new PrintWriter(outputStream);
FastReader s=new FastReader();
int n=s.nextInt();
int m=s.nextInt();
//int q=s.nextInt();
//int[] a=new int[n+1];
ArrayList<Integer>[] b=new ArrayList[n+1];
for(int i=1;i<n+1;i++) {
	
	b[i]=new ArrayList<>();
}
while(m>0) {
	int l=s.nextInt();
	int r=s.nextInt();
	b[l].add(r);
	b[r].add(l);
	m--;}
//boolean p1=true;
dfs_time(1,b,-1);
if(!p) {
out.println(0);
}else {
	int w=e11.size();
	for(int i=0;i<w;i+=2) {
	out.println(e11.get(i)+" "+e11.get(i+1));
	}
}
//System.out.println(p);
//System.out.println(p1);
//int q=s.nextInt();
//while(q>0) {
//	for(int i=1;i<n+1;i++) {
////		b[i]=new ArrayList<>();
//		visited[i]=0;
//		level[i]=0;
//	}
//	int a1=s.nextInt();
//	int b1=s.nextInt();
//	int[] v1=bfs(visited,b,a1+1);
//	out.println(level[b1]);
//	for(int i=1;i<n+1;i++) {
//	b[i]=new ArrayList<>();
//	visited[i]=0;
//	level[i]=0;
//}
//	q--;
//}
//out.close();
//for(int i=1;i<=n;i++) {
//	a[i]=s.nextInt();
//}
//int q=m;
//while(m>0) {
//	int l=s.nextInt();
//	int r=s.nextInt();
//	b[l].add(r);
//	b[r].add(l);
//	m--;
//}
//int[] a=new int[100000];
//a=bfs(visited,b,n);
//if(a[m]==-1) {
//	System.out.println("Impossible");
//}else {
//	System.out.println(a[m]);
//}
 
//int[] a=new int[n+1];
//subtree_size(visited,1,b,a);
//for(int i=1;i<=n;i++) {
//	System.out.println(a[i]);
//}
//dfs(visited,1,b,0);
//System.out.println(leng);
//System.out.println(end);
//for(int i=1;i<visited.length;i++) {
//	visited[i]=0;
//}
//dfs(visited,end,b,0);
//System.out.println(leng);
//System.out.println(end);
//for(int i=1;i<=n;i++) {
//	if(visited[i]==0) {
//		count++;
//		count_1=0;
//		dfs(visited,i,b);
//	sum=(sum*count_1)%(1000000007);
//	}
//}
//System.out.println(count+" "+sum);
//t--;
//}
//int[] in=new int[n+1];
//int[] out_1=new int[n+1];
//for(int i=1;i<=n;i++) {
//	if(visited[i]==0) {
//		time(visited,i,b,in,out_1);
//	}
//}
//for(int i=1;i<=n;i++) {
//	System.out.print(in[i]+" ");
//}
//System.out.println();
//for(int i=1;i<=n;i++) {
//	System.out.print(out_1[i]+" ");
//}
////boolean p=false;
//for(int i=1;i<=n;i++) {
//	if(visited[i]==0) {
//		boolean res=cycle_detection(visited,i,b,-1);
//		if(res==true) {
//			p=true;
//		}
//	}
//}
//if(p) {
//	System.out.println("YES");
//}else {
//	System.out.println("NO");
//}
//int m=s.nextInt();
//while(m>0) {
//	int i=s.nextInt();
//	gf[i]=1;
//	m--;
//}
//System.out.println(gf[2]);
//for(int i=1;i<=n;i++) {
//	for(int j=0;j<b[i].size();j++) {
//		out.print(a[b[i].get(j)]+" ");
//	}
//	out.println();
//}
//int count=0;
//for(int i=1;i<=n;i++) {
//	if(visited[i]==0) {
//		dfs(visited,i,b);
//		count++;
//	}
//}
//System.out.println(count);
//if(count==1 && q==n-1) {
//	System.out.println("YES");
//}else {
//	System.out.println("NO");
//}
//boolean p=true;
//for(int i=1;i<=n;i++) {
//	if(visited[i]==0) {
//	 boolean c=(dfs_2(visited,i,b,0));
//	 if(c==false) {
//		 p=false;
//	 }
//	}
//}
//System.out.println("Scenario #" +j +":");
//if(p) {
////	System.out.println("Scenario " +"#" +j +":");
//	System.out.println("No suspicious bugs found!");
//}else {
////	System.out.println("Scenario"+" "+"#"+j+":");
//	System.out.println("Suspicious bugs found!");
//}
//dfs_1(visited,1,b,0);
//System.out.println(min_gf);
//dfs(visited,1,a,b);
 
//f
//f
//f
//}	
out.close();

}
	public static int[] bfs(int[] visited,ArrayList[] b,int a) {
		visited[a]=1;
		int[] dist=new int[100000];
		for(int i=1000;i<=9999;i++) {
			dist[i]=-1;
		}
		dist[a]=0;
		Queue<Integer> queue=new LinkedList<>();
		queue.add(a);
		while(!queue.isEmpty()) {
			int v=queue.poll();
			for(int i=0;i<b[v].size();i++) {
				if(visited[(int)b[v].get(i)]==0) {
				queue.add((int) b[v].get(i));
				visited[(int)b[v].get(i)]=1;
				dist[(int)b[v].get(i)]=dist[v]+1;
				level[dist[(int)b[v].get(i)]]++;
				}
			}
		}
		return dist;
	}
	public static void dfs_col(int[] visited,int v,ArrayList[] b,int g,int[] a) {
		visited[v]=1;
		a[v]=g;
		for(int i=0;i<b[v].size();i++) {
			if(visited[ (int) b[v].get(i)]==0) {
				dfs_col(visited, (int) b[v].get(i),b,g,a);
			}
		}
	}
	public static void dfs(int[] visited,int v,ArrayList[] b,int g) {
		visited[v]=1;
		for(int i=0;i<b[v].size();i++) {
			if(visited[ (int) b[v].get(i)]==0) {
				dfs(visited, (int) b[v].get(i),b,g+1);
			}
		}
	}
	public static void maximum_dist(int[] visited,int v,ArrayList[] b,int g) {
	visited[v]=1;
	if(g>leng) {
		leng=g;
		end=v;	
	}
	for(int i=0;i<b[v].size();i++) {
		if(visited[ (int) b[v].get(i)]==0) {
			maximum_dist(visited, (int) b[v].get(i),b,g+1);
		}
	}
}
public static int subtree_size(int[] visited,int v,ArrayList[] b,int[] a) {
	visited[v]=1;
	int c=1;
	for(int i=0;i<b[v].size();i++) {
		if(visited[ (int) b[v].get(i)]==0) {
			c+=subtree_size(visited, (int) b[v].get(i),b,a);
			
		}
	}
	a[v]=c;
	return c;
}
public static void minimum_distance(int[] visited,int v,ArrayList[] b,int g) {
	
	visited[v]=1;
	if(gf[v]==1) {
		if(g<min_dist && g!=0) {
			min_dist=g;
			min_gf=v;
		}else if(g==min_dist) {
			if(v<min_gf) {
				v=min_gf;
				min_dist=g;
			}
		}
	}
	for(int i=0;i<b[v].size();i++) {
		if(visited[ (int) b[v].get(i)]==0) {
			minimum_distance(visited, (int) b[v].get(i),b,g+1);
		}
	}
}
public static boolean color_set(int[] visited,int v,ArrayList[] b,int g) {
	visited[v]=1;
	col[v]=g;
	for(int i=0;i<b[v].size();i++) {
		if(visited[(int) b[v].get(i)]==1) {
			if(col[(int)b[v].get(i)]==g) {
				return false;
			}
		}else {
//			if(!dfs_2(visited,(int)b[v].get(i),b,g^1)) {
//				return false;
//			}
			boolean p=color_set(visited,(int)b[v].get(i),b,g^1);
			if(!p) {
				return false;
			}
		}
	}
	return true;
	
}
public static boolean cycle_detection(int[] visited,int v,ArrayList[] b,int par) {
	visited[v]=1;
	for(int i=0;i<b[v].size();i++) {
		if(visited[(int)b[v].get(i)]==1) {
			if(par!=(int)b[v].get(i)) {
				return true;
			}
		}else {
			if(cycle_detection(visited,(int) b[v].get(i),b,v)==true) {
				return true;
			}
		}
	}
	return false;
	
}
public static void time(int[] visited,int v,ArrayList[] b,int[] in,int[] out) {
	visited[v]=1;
	in[v]=timer++;
	for(int i=0;i<b[v].size();i++) {
		if(visited[(int)b[v].get(i)]==0) {
			time(visited,(int)b[v].get(i),b,in,out);
		}
	}
	out[v]=timer++;
	
}
public static void dfs_time(int v,ArrayList[] b,int par) {
	visited[v]=1;
	in[v]=timer;
	low[v]=timer;
	timer++;
	int w=b[v].size();
	for(int i=0;i<w;i++) {
		if((int)b[v].get(i)==par) {

			continue;
		}else if(visited[(int)b[v].get(i)]==1){
			low[v]=Math.min(low[v], in[(int)b[v].get(i)]);
		if(in[v]>in[(int)b[v].get(i)]) {
			e11.add(v);
			e11.add((int)b[v].get(i));
		}
		
		}else {
			dfs_time((int)b[v].get(i),b,v);
			if(low[(int)b[v].get(i)]>in[v]) {
//				System.out.println(v + " "+ (int)b[v].get(i));
				p=false;
				return;
			}else {
				low[v]=Math.min(low[v], low[(int)b[v].get(i)]);
			e11.add(v);
			e11.add((int)b[v].get(i));
			}
		}
	}
}
 
}