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.util.*;
import java.io.*;
public class lp { 
static PrintWriter out = new PrintWriter(System.out);
static int mod = 1000000007;
static int time = 0; 
static boolean flag=false;
static class Edge{
     int s;
     int in;
     Edge(int S,int I)
     { s= S; in=I;}
}
static void bridgeUtil(LinkedList<Edge> l[],int u, boolean visited[], int disc[],int low[],int parent[]) 
{
        visited[u] = true; 
        disc[u] = low[u] = ++time; 
 
    
        for(Edge e : l[u]){
            if (!visited[e.s]) 
            { 
                parent[e.s] = u; 
                bridgeUtil(l,e.s, visited, disc, low, parent); 
                low[u]  = Math.min(low[u], low[e.s]); 
                if (low[e.s] > disc[u]) 
                   {
                      flag = true;
                       return ;
                   }
            } 
            else if (e.s != parent[u]) 
                low[u]  = Math.min(low[u], disc[e.s]); 
        } 
    } 
static void bridge(LinkedList<Edge> l[],int n) 
{ 
        boolean visited[] = new boolean[n]; 
        int disc[] = new int[n]; 
        int low[] = new int[n]; 
        int parent[] = new int[n]; 
  
        for (int i = 0; i < n; i++) 
            parent[i] =-1; 
 
                bridgeUtil(l,0, visited, disc, low, parent); 
} 
static void dfs(LinkedList<Edge> l[],int s,int E[][],boolean visited[],int level[])
{
        visited[s]=true;
        for(Edge e : l[s])
          {
             int v = e.s;
             int in = e.in;
             if(visited[v]==false)
               {
                   level[v] = level[s]+1;
                   E[in][0]=s+1;
                   E[in][1]=v+1;
                   dfs(l,v,E,visited,level);
               }
             else
               {
                   if((E[in][0]+E[in][1])==0)
                    {
                        E[in][0]= level[s]> level[v] ? (s+1) : (v+1);
                        E[in][1]= level[v]> level[s] ? (s+1) : (v+1);
                     }
                }
          }
}
public static void main(String[] args) throws Exception{
 
int n = ni();
int m = ni();
LinkedList<Edge> l[] = new LinkedList[n];

for(int i=0;i<n;i++)
    l[i] = new LinkedList();
 
for(int i=1;i<=m;i++)
{
   int u = ni();
   int v = ni();
   Edge e1 = new Edge(u-1,i-1);
   Edge e2 = new Edge(v-1,i-1);
   l[u-1].add(e2);
   l[v-1].add(e1);
}
     bridge(l,n); 
if(flag==true)
   pn(0);
else
{
    boolean v[] = new boolean[n];
    int e[][] = new int[m][2];
    int level[] = new int[n];
     dfs(l,0,e,v,level);
    for(int i=0;i<m;i++)
       pn(e[i][0]+" "+e[i][1]);
}
   out.flush();
} 
 
/*static void add(int index,int val)
{
       while(index<BIT.length)
           {
                BIT[index] = BIT[index]+val;
                index = index + (index&(-index));
           }
}
static int get_sum(int index)
{
       int sum=0;
       while(index>0)
         {
              sum = sum+BIT[index];
              index = index- (index&(-index));
         }
      return sum;
} */
static int[] ai(int n)  // it will give in array of size n
{
    int a[] = new int[n];
    for(int i=0;i<n;i++)
        a[i] = ni();
    return a;
}
static long[] al(int n)  // it will give in array of size n
{
    long a[] = new long[n];
    for(int i=0;i<n;i++)
        a[i] = nl();
    return a;
}
 
static void p(Object o)
{
   out.print(o);
}
static void pn(Object o)
{
    out.println(o);
}
static int abs(int x)
{
    return x>0 ? x : -x;
}
static long gcd(long a,long b)
{
       if(b%a==0)
          return a;
          return gcd(b%a,a);
}
static int count_set(int n)
{
   int c=0;
while(n>0)
{
   if(n%2==1)
     c++;
     n=n/2;
}
   return c;
}
static void subtract_1(char s[]) // it will subtract 1 from the given number.  number should be positive
{
      if(s[0]=='0') // number is zero
          return;
     int n = s.length,i=n-1;
     while(s[i]=='0')
       i--;
     s[i] = (char)((int)(s[i]-'0') + 47);
   
     for(int j=i+1;j<n;j++)
         s[j]='9';
}
static long pow(long a,long b,long md)
{ 
    long ans=1;
    while(b>0)
    {
         if(b%2==1)
           ans = (ans*a)%md;
           a = (a*a)%md;
           b = b/2;
    }
   return ans;
}
static long min(long a,long b){
 
     return a<b ? a : b;
}
static long max(long a,long b){
     return a>b ? a : b;
}
static boolean pal(String s)
{
   int n = s.length(),i1=0,i2=n-1;
 
     while(i1<i2)
     {
        if(s.charAt(i1)!=s.charAt(i2))
             return false;
             i1++; i2--;
     }
       return true;
}
static String rev(String r)
{
    String s = "";
    int i= r.length()-1;
 
    while(i>=0)
    {
        s=s+r.charAt(i);
        i--;   
    }
       return s;
}
static FastReader sc=new FastReader(); 
 
      static int ni(){
                 int x = sc.nextInt();
                 return(x);
        }
      static long nl(){
              long x = sc.nextLong();
              return(x);
         }
      static String n(){
                 String str = sc.next();
                     return(str);
       }
     static String ns(){
                 String str = sc.nextLine();
                   return(str);
      }
     static double nd(){
               double d = sc.nextDouble();
                 return(d);
       }
  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; 
        } 
    } 
}