5
5 3
2 4
3 1
4 5
 4
2 4
3 2
2 1
 5
5 3
2 4
3 1
4 5
 2
1 2
 4
3 4
2 3
3 1
 10
8 10
2 9
7 8
4 1
7 3
4 7
2 5
2 4
4 6
 5
3 4
3 2
3 1
1 5
 3
1 2
2 3
 5
1 2
1 3
1 4
1 5

1 2
2 3
2 4
 1 3
2 4
3 5
4 5
 1 2
 1 3
2 3
3 4
 1 4
2 4
2 5
2 9
3 7
4 6
4 7
7 8
8 10
 1 3
1 5
2 3
3 4
 1 2
2 3
 1 2
1 3
1 4
1 5



import java.io.*;
import java.math.*;
import java.util.*;


// @author : Dinosparton 

public class test {
	 
	   static class Pair{ 
		   long x;
		   long y;
		   
		   Pair(long x,long y){ 
			   this.x = x;
			   this.y = y;
			   
		   }
	   }
	  
	   static class Sort implements Comparator<Pair>
	   {

	       @Override
	       public int compare(Pair a, Pair b)
	       {
	           if(a.x!=b.x)
	           {
	               return (int)(a.x - b.x);
	           }
	           else
	           {
	               return (int)(a.y-b.y);
	           }
	       }
	   }
	   
	   static class Compare { 
		   
		     void compare(Pair arr[], int n) 
		    { 
		        // Comparator to sort the pair according to second element 
		        Arrays.sort(arr, new Comparator<Pair>() { 
		            @Override public int compare(Pair p1, Pair p2) 
		            { 
		            	if(p1.x!=p2.x) {
		                return (int)(p1.x - p2.x); 
		            	}
		            	else { 
		            		return (int)(p1.y - p2.y);
		            	}
		            } 
		        }); 
		  
//		        for (int i = 0; i < n; i++) { 
//		            System.out.print(arr[i].x + " " + arr[i].y + " "); 
//		        } 
//		        System.out.println(); 
		    } 
		} 
	 
	   static class Scanner {
	        BufferedReader br;
	        StringTokenizer st;
	 
	        public Scanner()
	        {
	            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 void main(String args[]) throws Exception { 
		
		   
		   Scanner sc = new Scanner();
		   StringBuilder res = new StringBuilder();
		  
		   int tc = 1;
		  
		   while(tc-->0) { 
			
			int n = sc.nextInt();
			
			ArrayList<Pair> ans = new ArrayList<>();
			
		    System.out.println('?'+" "+1);
		    System.out.flush();
		    int a[] = new int[n];
		    
		    for(int i=0;i<n;i++) { 
		    	a[i] = sc.nextInt();
		    }
		    
		    int odd = 0;
		    int even = 0;
		    
		    for(int i=1;i<n;i++) { 
		    	if(a[i]==1) { 
		    		
		    		ans.add(new Pair(1,i+1));
		    	}
		    	
		    	if(a[i]%2==0) {
		    		even++;
		    	}
		    	else { 
		    		odd++;
		    	}
		    }
		    
		    if(odd<even) { 
		    	
		    	for(int i=1;i<n;i++) { 
		    		if(a[i]%2!=0) { 
		    			 System.out.println('?'+" "+(i+1));
		    			 System.out.flush();
		    		
		    		
		    		int temp[] = new int[n];
				    
				    for(int j=0;j<n;j++) { 
				    	temp[j] = sc.nextInt();
				    }
				   
				    
				    for(int j=1;j<n;j++) { 
				    	if(temp[j]==1) { 
				    		
				    		ans.add(new Pair(j+1,i+1));
				    	}
				    	
				    }
		    	}
		    	}
		    }
		    else { 
		    	
		    	for(int i=1;i<n;i++) { 
		    		if(a[i]%2==0) { 
		    			 System.out.println('?'+" "+(i+1));
		    			 System.out.flush();
		    		
		    		
		    		int temp[] = new int[n];
				    
				    for(int j=0;j<n;j++) { 
				    	temp[j] = sc.nextInt();
				    }
				   
				    
				    for(int j=1;j<n;j++) { 
				    	if(temp[j]==1) { 
				    		
				    		ans.add(new Pair(j+1,i+1));
				    	}
				    	
				    }
		    	}
		    	}
		    }
		    
		    System.out.println('!');
		    for(Pair p : ans) { 
		    	System.out.println(p.x+" "+p.y);
		    }
		    System.out.flush();
		   }
		   
		   System.out.println(res);
	   }
}  




