import java . util . ArrayList ; import java . util . Arrays ; import java . util . Comparator ; import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int t = s . nextInt ( ) ; for ( int i = 0 ; i < t ; i ++ ) { int n = s . nextInt ( ) ; long w = s . nextLong ( ) ; pair [ ] arr = new pair [ n ] ; for ( int j = 0 ; j < n ; j ++ ) { long val = s . nextLong ( ) ; pair p = new pair ( val , j ) ; arr [ j ] = p ; } Arrays . sort ( arr , new comp ( ) ) ; ArrayList < Integer > list = new ArrayList < > ( ) ; long sum = 0 ; for ( int j = n - 1 ; j >= 0 ; j -- ) { if ( sum + arr [ j ] . data <= w ) { sum = sum + arr [ j ] . data ; list . add ( arr [ j ] . index + 1 ) ; } } long limit = w / 2 ; if ( w % 2 != 0 ) limit ++ ; if ( sum >= limit ) { System . out . println ( list . size ( ) ) ; for ( int j = 0 ; j < list . size ( ) ; j ++ ) { System . out . print ( list . get ( j ) + " ▁ " ) ; } System . out . println ( ) ; } else { System . out . println ( - 1 ) ; } } } }   class pair { long data ; int index ; public pair ( long data , int index ) { this . data = data ; this . index = index ; } }   class comp implements Comparator < pair > { public int compare ( pair a , pair b ) { return ( int ) ( a . data - b . data ) ; } }

import sys , functools , collections , bisect , math , NEW_LINE INDENT heapqinput = sys . stdin . readline NEW_LINE DEDENT


import mathfor NEW_LINE _ in range ( int ( input ( ) ) ) : n , w = map ( int , input ( ) . split ( ) ) NEW_LINE l = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE f = 0 NEW_LINE s = 0 NEW_LINE t = [ ] NEW_LINE for i in range ( n ) : if NEW_LINE l [ i ] >= math . ceil ( w / 2 ) and l [ i ] <= w : t = [ i + 1 ] NEW_LINE s = l [ i ] NEW_LINE break else : s += l [ i ] NEW_LINE if s > w : NEW_LINE INDENT s -= l [ i ] else : NEW_LINE t . append ( i + 1 ) NEW_LINE DEDENT if s >= math . ceil ( w / 2 ) : break NEW_LINE if s >= math . ceil ( w / 2 ) : print ( len ( t ) ) NEW_LINE print ( * t ) else : print ( - 1 ) NEW_LINE


import sys , mathfrom NEW_LINE collections NEW_LINE import defaultdict , dequeinput = sys . stdin . readline     t = int ( input ( ) ) NEW_LINE while ( t > 0 ) : n , w = map ( int , input ( ) . split ( ) ) NEW_LINE l = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE


import sys , mathfrom NEW_LINE collections NEW_LINE import defaultdict , dequeinput = sys . stdin . readline     t = int ( input ( ) ) NEW_LINE while ( t > 0 ) : n , w = map ( int , input ( ) . split ( ) ) NEW_LINE l = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE ll = [ ] NEW_LINE f = 0 NEW_LINE mini = math . ceil ( w / 2 ) NEW_LINE cursum = 0 NEW_LINE for i in range ( n ) : cur = l [ i ] NEW_LINE if ( cur >= mini and cur <= w ) : print ( 1 ) NEW_LINE print ( i + 1 ) NEW_LINE f = 1 NEW_LINE break elif ( cur < mini ) : ll . append ( i + 1 ) NEW_LINE if ( f == 0 ) : ans = [ ] NEW_LINE for i in ll : cursum += l [ i - 1 ] NEW_LINE ans . append ( i ) NEW_LINE if ( cursum >= mini ) : break NEW_LINE if ( cursum >= mini ) : print ( len ( ans ) ) NEW_LINE print ( * ans ) else : print ( - 1 ) NEW_LINE t -= 1   NEW_LINE


import java . util . * ; import java . io . * ;   public class cf_6 { public static void main ( String [ ] args ) { new Solution ( ) . solve ( ) ; } }   class Solution { public void solve ( ) { FastScanner fs = new FastScanner ( ) ; int tests = fs . nextInt ( ) ; testcase : for ( int t = 0 ; t < tests ; t ++ ) { int n = fs . nextInt ( ) ; long w = fs . nextLong ( ) ; int [ ] weights = fs . readIntArray ( n ) ; long minRequired = ( w + 1 ) / 2 ;


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ;   public class KnapSack { 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 ( ) ) ; }   String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; }   double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } }   public static void main ( String [ ] args ) { FastReader in = new FastReader ( ) ; int t = in . nextInt ( ) ; StringBuilder sb = new StringBuilder ( ) ; while ( t -- > 0 ) { int n = in . nextInt ( ) ; long w = in . nextLong ( ) ; Pair arr [ ] = new Pair [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { long temp = in . nextLong ( ) ; arr [ i ] = new Pair ( i + 1 , temp ) ; } Arrays . sort ( arr , new Sort ( ) ) ; ArrayList < Integer > ans = new ArrayList < > ( ) ; long sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( sum + arr [ i ] . val <= w ) { ans . add ( arr [ i ] . ind ) ; sum += arr [ i ] . val ; } }


import java . awt . Point ; import java . util . Arrays ; import java . util . Collections ; import java . util . Comparator ; import java . util . Scanner ;   public class A1446 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int T = in . nextInt ( ) ; for ( int t = 0 ; t < T ; t ++ ) { int N = in . nextInt ( ) ; long W = in . nextLong ( ) ; Point [ ] P = new Point [ N ] ; for ( int n = 0 ; n < N ; n ++ ) { int a = in . nextInt ( ) ; P [ n ] = new Point ( a , n + 1 ) ; } Collections . sort ( Arrays . asList ( P ) , new Comparator < Point > ( ) { @ Override public int compare ( Point o1 , Point o2 ) { return o2 . x - o1 . x ; } } ) ; long weight = 0 ; int count = 0 ; StringBuilder indices = new StringBuilder ( ) ; for ( Point p : P ) { long nextWeight = weight + p . x ; if ( nextWeight <= W ) { count ++ ; indices . append ( p . y ) . append ( ' ▁ ' ) ; weight = nextWeight ; } } if ( 2 * weight >= W ) { System . out . println ( count ) ; System . out . println ( indices ) ; } else { System . out . println ( " - 1" ) ; } } }   }


import java . util . * ; import java . io . * ;   public class Chewbacca { public static void main ( String [ ] args ) { FastReader reader = new FastReader ( ) ;   String num = reader . nextLine ( ) ; String f = " " ; for ( int i = 0 ; i < num . length ( ) ; ++ i ) { if ( i == 0 ) { if ( '5' <= num . charAt ( 0 ) && num . charAt ( 0 ) <= '8' ) System . out . print ( ( char ) ( '0' + 9 - num . charAt ( 0 ) + '0' ) ) ; else System . out . print ( num . charAt ( 0 ) ) ; } else { if ( '5' <= num . charAt ( i ) && num . charAt ( i ) <= '9' ) System . out . print ( ( char ) ( '0' + 9 - num . charAt ( i ) + '0' ) ) ; else System . out . print ( num . charAt ( i ) ) ; } } }   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 ; } } }

s = input ( ) sl = [ ] for j in s : sl . append ( int ( j ) ) i = 0 while i < len ( sl ) : if sl [ i ] >= 5 : if i == 0 and sl [ i ] == 9 : s += ' bruh ' else : sl [ i ] = 9 - sl [ i ] i += 1   k = len ( sl ) p = 1 num = 0 while k > 0 : k -= 1 num += p * sl [ k ] p *= 10 print ( num ) NEW_LINE


n = str ( input ( ) )   i = 0 store = 0 if n [ i ] == '9' : store = store * 10 + ( ord ( n [ i ] ) - ord ( '0' ) ) i += 1   while i < len ( n ) : if n [ i ] >= '5' : a = ord ( '9' ) - ord ( n [ i ] ) NEW_LINE


s = input ( ) ans = ' '   if s [ 0 ] == '9' and len ( s ) == 1 : print ( '9' ) else : for i in range ( 0 , len ( s ) ) : check = int ( s [ i ] ) if ( i == 0 and s [ i ] == '9' ) : ans += '9' continue elif check >= 5 : num = 9 - int ( s [ i ] ) ans += str ( num ) else : ans += s [ i ] print ( ans ) NEW_LINE


def digitList ( n ) : lst = [ ] while n > 0 : lst . append ( n % 10 ) n //= 10 lst . reverse ( ) return lst   def answer ( x ) : lst = digitList ( x ) NEW_LINE


n = input ( ) s = ' ' for i in n : x = int ( i ) if x > 4 : s = s + str ( 9 - x ) else : s = s + str ( x ) if s [ 0 ] == '0' : print ( '9' + s [ 1 : ] ) else : print ( s ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; import java . io . PrintWriter ;       public class A {     public static void main ( String [ ] args ) throws IOException { FastReader sc = new FastReader ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; String str = sc . next ( ) ; int n = Character . getNumericValue ( str . charAt ( 0 ) ) ; out . print ( ( n != 9 && n >= 5 ) ? ( 9 - n ) : n ) ;    for ( int i = 1 ; i < str . length ( ) ; i ++ ) { n = Character . getNumericValue ( str . charAt ( i ) ) ; if ( n >= 5 ) out . print ( 9 - n ) ;   else out . print ( n ) ; }   out . close ( ) ; }


import java . io . * ; import java . util . * ; import static java . lang . Math . * ;   public class Solution { FastReader sc ; int M = ( int ) ( 1e9 + 7 ) ; boolean tc = false ;   void solver ( int tc ) { try { while ( tc -- != 0 ) { char [ ] ch = sc . next ( ) . toCharArray ( ) ; for ( int i = 0 ; i < ch . length ; i ++ ) { char c = ch [ i ] ; int x = Character . getNumericValue ( c ) ; if ( i == 0 && x == 9 ) System . out . print ( 9 ) ; else System . out . print ( Math . min ( 9 - x , x ) ) ; } } } catch ( Throwable ex ) { ex . printStackTrace ( System . out ) ; } }   void runner ( ) throws IOException { try { sc = new FastReader ( ) ; solver ( tc ? sc . nextInt ( ) : 1 ) ; } catch ( Exception ex ) {   } }   public static void main ( String [ ] args ) { try { new Solution ( ) . runner ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } }   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 ; }   } }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . lang . Math . * ; import java . text . DecimalFormat ; import java . util . * ;    public class Main { static class FastScanner { BufferedReader br ; StringTokenizer st ;   public FastScanner ( ) { 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 ; } } static long gcd ( long a , long b ) { if ( b == 0 ) return a ; return gcd ( b , a % b ) ; } static long sumofdigits ( long x ) { long sum = 0 ; while ( x > 0 ) { sum = sum + x % 10 ; x /= 10 ; } return sum ; } public static void main ( String [ ] args ) throws java . lang . Exception { FastScanner fs = new FastScanner ( ) ; ArrayList < Integer > al = new ArrayList < > ( ) ; int a = fs . nextInt ( ) ; int b = fs . nextInt ( ) ; int c = fs . nextInt ( ) ; al . add ( a + b * c ) ; al . add ( a * ( b + c ) ) ; al . add ( a * b * c ) ; al . add ( a + b + c ) ; al . add ( ( a * b ) + c ) ; al . add ( ( a + b ) * c ) ; int max = Collections . max ( al ) ; System . out . println ( max ) ; } }

a = int ( input ( ) ) b = int ( input ( ) ) c = int ( input ( ) ) res = max ( a * b * c , a + b + c , ( a + b ) * c , a + ( b * c ) , ( a * b ) + c , a * ( b + c ) ) print ( res ) NEW_LINE


a = int ( input ( ) ) b = int ( input ( ) ) c = int ( input ( ) ) print ( max ( a + b + c , ( a + b ) * c , a * ( b + c ) , a * b * c ) ) NEW_LINE


number1 = int ( input ( ) ) number2 = int ( input ( ) ) number3 = int ( input ( ) )   one = number1 + number2 + number3two = number1 * number2 * number3three = ( number1 + number2 ) * number3four = number1 * ( number2 + number3 )   list1 = [ one , two , three , four ]   print ( max ( list1 ) ) NEW_LINE


a = int ( input ( ) ) b = int ( input ( ) ) c = int ( input ( ) ) print ( max ( a + b + c , a + b * c , ( a + b ) * c , a * b + c , a * ( b + c ) , a * b * c ) ) NEW_LINE


import java . io . * ; import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int max = Integer . MIN_VALUE ; int ans = a + b + c ; max = Math . max ( ans , max ) ; ans = a + ( b * c ) ; max = Math . max ( ans , max ) ; ans = a * ( b + c ) ; max = Math . max ( ans , max ) ; ans = a * b * c ; max = Math . max ( ans , max ) ; ans = ( a + b ) * c ; max = Math . max ( ans , max ) ; ans = ( a * b ) + c ; max = Math . max ( ans , max ) ; System . out . println ( max ) ; } }


import java . util . Scanner ;   public class expreession { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a == 1 && b == 1 && c != 1 ) { System . out . println ( ( a + b ) * c ) ; } else if ( a == 1 && b != 1 && c != 1 ) { System . out . println ( ( a + b ) * c ) ; } else if ( a == 1 && b == 1 && c == 1 ) { System . out . println ( a + b + c ) ; } else if ( a == 1 && b != 1 && c == 1 ) { System . out . println ( a + b + c ) ; } else if ( a != 1 && b == 1 && c == 1 ) { System . out . println ( a * ( b + c ) ) ; } else if ( a != 1 && b == 1 && c != 1 ) { if ( a > c ) { System . out . println ( a * ( b + c ) ) ; } else { System . out . println ( ( a + b ) * c ) ; } } else if ( a != 1 && b != 1 && c == 1 ) { System . out . println ( a * ( b + c ) ) ; } else { System . out . println ( a * b * c ) ; } } }


import java . io . FileNotFoundException ; import java . io . PrintWriter ; import java . math . BigInteger ; import java . util . Arrays ; import java . util . Comparator ; import java . util . Scanner ;   public class Main {    public static void main ( String [ ] args ) throws FileNotFoundException { Scanner sc = new Scanner ( System . in ) ; PrintWriter pw = new PrintWriter ( System . out ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int ans = a + b + c ; ans = Math . max ( ans , ( a + b ) * c ) ; ans = Math . max ( ans , a * ( b + c ) ) ; ans = Math . max ( ans , a * b * c ) ; System . out . println ( ans ) ; } }


import java . util . Arrays ; import java . util . Scanner ; import java . util . StringTokenizer ;   public class ChoosingTeams { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ;   String line = scanner . nextLine ( ) ; StringTokenizer tokenizer = new StringTokenizer ( line ) ; int n = Integer . parseInt ( tokenizer . nextToken ( ) ) ; int k = Integer . parseInt ( tokenizer . nextToken ( ) ) ;   int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = scanner . nextInt ( ) ; }   int [ ] ints = Arrays . stream ( arr ) . filter ( e -> e + k <= 5 ) . toArray ( ) ;   System . out . println ( ints . length / 3 ) ;   } }

n , k = map ( int , input ( ) . split ( ) )   y = [ int ( i ) for i in input ( ) . split ( ) ]   y = [ 5 - i for i in y ]   y . sort ( reverse = True )   NEW_LINE


from collections import Counterimport math   def solve ( ) : n , k = list ( map ( int , input ( ) . split ( ) ) ) array = list ( map ( int , input ( ) . split ( ) ) ) array . sort ( ) if ( n % 3 == 0 ) : end = n else : end = n - n % 3   i , count = 0 , 0   while i < end - 2 : if array [ i ] + k <= 5 and array [ i + 1 ] + k <= 5 and array [ i + 2 ] + k <= 5 : count += 1 else : break i += 3 return count     print ( solve ( ) ) NEW_LINE


n , k = map ( int , input ( ) . split ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) count = 0 teams = 0 for num in arr : if num + k <= 5 : count += 1 print ( count // 3 ) NEW_LINE


s = input ( ) . split ( ' ▁ ' ) n = int ( s [ 0 ] ) k = int ( s [ 1 ] ) s = input ( ) . split ( ' ▁ ' ) l = len ( s ) count = 0 for i in range ( l ) : if ( k + int ( s [ i ] ) <= 5 ) : count = count + 1   print ( int ( count / 3 ) ) NEW_LINE


a = list ( map ( int , input ( ) . split ( ) ) ) b = list ( map ( int , input ( ) . split ( ) ) )   k = [ ] for i in range ( len ( b ) ) : if 5 - b [ i ] >= a [ 1 ] : k . append ( b [ i ] )   print ( len ( k ) // 3 ) NEW_LINE


import java . util . Scanner ;   public class A432 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ;   int n = scanner . nextInt ( ) , k = scanner . nextInt ( ) , count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int y = scanner . nextInt ( ) ; if ( 5 - y >= k ) { count ++ ; } } System . out . println ( count / 3 ) ; } }


import java . io . InputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . InputStream ; import java . util . * ; public class A432 { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int np = sc . nextInt ( ) ; int nto = sc . nextInt ( ) ; int arr [ ] = new int [ np ] ; for ( int i = 0 ; i < np ; i ++ ) { arr [ i ] = sc . nextInt ( ) + nto ; } int ans = 0 ; for ( int j = 0 ; j < np ; j ++ ) { if ( arr [ j ] <= 5 ) { ans ++ ; } } if ( ans >= 3 ) { ans = ans / 3 ; System . out . println ( ans ) ; } else System . out . println ( 0 ) ; } }


import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int count = 0 ; int tot = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int m = sc . nextInt ( ) ; if ( 5 - m >= k ) { count ++ ; } if ( count == 3 ) { tot ++ ; count = 0 ; } } System . out . println ( tot ) ; } } ;


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int count = 0 ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = sc . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( ( a [ i ] + k ) <= 5 ) count ++ ; } System . out . println ( count / 3 ) ; } }


import java . util . * ;   public class Check2 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; int [ ] ar = new int [ t ] ; for ( int i = 0 ; i < t ; i ++ ) { ar [ i ] = sc . nextInt ( ) ; } int spectator = 3 ; int op1 = 1 ; int op2 = 2 ; boolean ans = true ; for ( int i = 0 ; i < t ; i ++ ) { if ( ar [ i ] != spectator ) { if ( ar [ i ] == op1 ) { int temp = op2 ; op2 = spectator ; spectator = temp ; } else { int temp = op1 ; op1 = spectator ; spectator = temp ; } } else { ans = false ; break ; } } if ( ans ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; }         }     public static long power ( long a , long b , long c ) { long ans = 1 ; while ( b != 0 ) { if ( b % 2 == 1 ) { ans = ans * a ; ans %= c ; } a = a * a ; a %= c ; b /= 2 ; } return ans ; }   public static long power1 ( long a , long b , long c ) { long ans = 1 ; while ( b != 0 ) { if ( b % 2 == 1 ) { ans = multiply ( ans , a , c ) ; } a = multiply ( a , a , c ) ; b /= 2 ;   } return ans ;   }   public static long multiply ( long a , long b , long c ) { long res = 0 ; a %= c ; while ( b > 0 ) { if ( b % 2 == 1 ) { res = ( res + a ) % c ; } a = ( a + a ) % c ; b /= 2 ; }   return res % c ;   }   public static long totient ( long n ) { long result = n ; for ( long i = 2 ; i * i <= n ; i ++ ) { if ( n % i == 0 ) {


n = int ( input ( ) ) now = [ 1 , 2 ] for i in range ( n ) : a = int ( input ( ) ) if a == now [ 0 ] : now [ 1 ] = 6 - sum ( now ) elif a == now [ 1 ] : now [ 0 ] = 6 - sum ( now ) else : print ( " NO " ) breakelse : print ( " YES " ) NEW_LINE


n = int ( input ( ) ) a , b , c = 1 , 2 , 3 for _ in range ( n ) : x = int ( input ( ) ) if x == c : print ( " NO " ) exit ( ) t1 = x t2 = a + b - x t3 = c a = t1 b = t3 c = t2   print ( " YES " ) NEW_LINE


n = int ( input ( ) ) spectator = 3 flag = Truefor i in range ( n ) : winner = int ( input ( ) ) if winner == spectator : flag = False break if 1 != spectator and 1 != winner : spectator = 1 elif 2 != spectator and 2 != winner : spectator = 2 elif 3 != spectator and 3 != winner : spectator = 3 if flag : print ( " YES " ) else : print ( " NO " )   NEW_LINE


n = int ( input ( ) ) spectator = 3 flag = Truefor i in range ( n ) : winner = int ( input ( ) ) if winner == spectator : flag = False break spectator = 6 - winner - spectatorif flag : print ( " YES " ) else : print ( " NO " )   NEW_LINE


import java . util . ArrayList ; import java . util . Arrays ; import java . util . Scanner ; import java . util . jar . JarOutputStream ;   public class Practise {    public static void main ( String [ ] args ) {


import java . util . * ; public class ChessForThree { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int winner [ ] = new int [ n ] ; int loser [ ] = new int [ n ] ; int spectator [ ] = new int [ n ] ; boolean flag = true ; int first = 1 ; for ( int i = 0 ; i < n ; i ++ ) { winner [ i ] = sc . nextInt ( ) ; } spectator [ 0 ] = 3 ; loser [ 0 ] = winner [ 0 ] == 1 ? 2 : 1 ; for ( int i = 0 ; i < n - 1 ; i ++ ) { if ( winner [ i ] != winner [ i + 1 ] ) { loser [ i + 1 ] = winner [ i ] ; spectator [ i + 1 ] = loser [ i ] ; } else { spectator [ i + 1 ] = loser [ i ] ; loser [ i + 1 ] = spectator [ i ] ; } if ( ( spectator [ i + 1 ] == winner [ i + 1 ] ) || ( winner [ 0 ] == 3 ) ) flag = false ; } if ( flag && winner [ 0 ] != 3 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } }


import java . util . * ; import java . util . Scanner ; import java . io . * ; import javax . lang . model . util . ElementScanner6 ; import static java . lang . System . out ; import java . util . Stack ; import java . util . Queue ; import java . util . LinkedList ;   public class A893 {       static int mod = ( int ) ( 1e9 + 7 ) ; static long MOD = ( long ) ( 1e9 + 7 ) ; static FastReader in = new FastReader ( ) ; static PrintWriter pr = new PrintWriter ( new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ) ; public static void main ( String args [ ] ) {   int tc = 1 ;


import java . io . * ; import java . math . BigInteger ; import java . util . * ; public class C { static BufferedReader br ; static int cin ( ) throws Exception { return Integer . valueOf ( br . readLine ( ) ) ; } static int [ ] split ( ) throws Exception { String [ ] cmd = br . readLine ( ) . split ( " ▁ " ) ; int [ ] ans = new int [ cmd . length ] ; for ( int i = 0 ; i < cmd . length ; i ++ ) { ans [ i ] = Integer . valueOf ( cmd [ i ] ) ; } return ans ; } static long p = 1000000007 ; static long power ( long x , long y ) { long res = 1 ; x = x % p ; if ( x == 0 ) return 0 ; while ( y > 0 ) { if ( ( y & 1 ) == 1 ) res = ( res * x ) % p ; y = y >> 1 ; x = ( x * x ) % p ; } return res ; } public static void main ( String [ ] args ) throws Exception {

""" 400110101 """     def calc ( s , n , d ) : cnts = [ len ( v ) for v in d . values ( ) ]   half = n // 2 for a in range ( 0 , cnts [ 0 ] + 1 ) : for b in range ( 0 , cnts [ 1 ] + 1 ) : c = n - 2 * a - b - s d = a + s - half   if 0 <= c <= cnts [ 2 ] and 0 <= d <= cnts [ 3 ] and a + b + c + d == half and b + c + 2 * d == s : return True , a , b , c , d return False ,     def main ( ) : n = int ( input ( ) ) c_arr = list ( map ( int , list ( input ( ) ) ) ) a_arr = list ( map ( int , list ( input ( ) ) ) )   s = 0 kinds = [ ( 0 , 0 ) , ( 0 , 1 ) , ( 1 , 0 ) , ( 1 , 1 ) ] d = { kind : [ ] for kind in kinds } for i in range ( n ) : if a_arr [ i ] == 1 : s += 1   d [ ( c_arr [ i ] , a_arr [ i ] ) ] . append ( i )   result , * params = calc ( s , n , d )   if not result : print ( - 1 ) else : flags = [ False ] * n   for i , kind in enumerate ( kinds ) : for j in range ( params [ i ] ) : ix = d [ kind ] [ j ] flags [ ix ] = True   for i in range ( n ) : if flags [ i ] : print ( i + 1 , end = ' ▁ ' )     if __name__ == ' _ _ main _ _ ' : main ( ) NEW_LINE


""" 400110101 """     def calc ( s , n , d ) : cnts = [ len ( v ) for v in d . values ( ) ]   half = n // 2 for a in range ( 0 , cnts [ 0 ] + 1 ) : for b in range ( 0 , cnts [ 1 ] + 1 ) : c = n - 2 * a - b - s d = a + s - half   if 0 <= c <= cnts [ 2 ] and 0 <= d <= cnts [ 3 ] and a + b + c + d == half and b + c + 2 * d == s : return True , a , b , c , d return False ,     def main ( ) : n = int ( input ( ) ) c_arr = list ( map ( int , list ( input ( ) ) ) ) a_arr = list ( map ( int , list ( input ( ) ) ) )   s = 0 kinds = [ ( 0 , 0 ) , ( 0 , 1 ) , ( 1 , 0 ) , ( 1 , 1 ) ] d = { kind : [ ] for kind in kinds } for i in range ( n ) : if a_arr [ i ] == 1 : s += 1   d [ ( c_arr [ i ] , a_arr [ i ] ) ] . append ( i )   result , * params = calc ( s , n , d )   if not result : print ( - 1 ) else : ans = [ ] for i , kind in enumerate ( kinds ) : for j in range ( params [ i ] ) : ix = d [ kind ] [ j ] ans . append ( str ( ix + 1 ) ) print ( ' ▁ ' . join ( ans ) )     if __name__ == ' _ _ main _ _ ' : main ( ) NEW_LINE


""" 400110101 """ import sysinput = sys . stdin . readline     def calc ( s , n , d ) : cnts = [ len ( v ) for v in d . values ( ) ]   half = n // 2 for a in range ( 0 , cnts [ 0 ] + 1 ) : for b in range ( 0 , cnts [ 1 ] + 1 ) : c = n - 2 * a - b - s d = a + s - half   if 0 <= c <= cnts [ 2 ] and 0 <= d <= cnts [ 3 ] and a + b + c + d == half and b + c + 2 * d == s : return True , a , b , c , d return False ,     def main ( ) : n = int ( input ( ) ) c_arr = list ( map ( int , list ( input ( ) . rstrip ( ) ) ) ) a_arr = list ( map ( int , list ( input ( ) . rstrip ( ) ) ) )   s = 0 kinds = [ ( 0 , 0 ) , ( 0 , 1 ) , ( 1 , 0 ) , ( 1 , 1 ) ] d = { kind : [ ] for kind in kinds } for i in range ( n ) : if a_arr [ i ] == 1 : s += 1   d [ ( c_arr [ i ] , a_arr [ i ] ) ] . append ( i )   result , * params = calc ( s , n , d )   if not result : print ( - 1 ) else : ans = [ ] for i , kind in enumerate ( kinds ) : for j in range ( params [ i ] ) : ix = d [ kind ] [ j ] ans . append ( str ( ix + 1 ) ) print ( ' ▁ ' . join ( ans ) )     if __name__ == ' _ _ main _ _ ' : main ( ) NEW_LINE


import java . util . * ; import java . io . * ;   public class Circus {


import java . util . Arrays ; import java . util . Locale ; import java . util . Scanner ; import java . lang . String ; import java . util . Random ;   public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; for ( int j = 0 ; j < a ; j ++ ) {   int n = sc . nextInt ( ) ;   for ( int i = 0 ; i < n ; i ++ ) { System . out . print ( 1 + " ▁ " ) ; } System . out . println ( ) ; } } }

t = int ( input ( ) ) for i in range ( t ) : n = int ( input ( ) ) for j in range ( n ) : print ( '1' , end = " ▁ " ) print ( ) NEW_LINE


for _ in range ( int ( input ( ) ) ) : print ( * [ 1 ] * int ( input ( ) ) , sep = " ▁ " ) NEW_LINE


t = int ( input ( ) ) for i in range ( t ) : a = int ( input ( ) ) print ( '1 ▁ ' * a ) NEW_LINE


def create_array ( n ) : a = [ ] up = 0 c = 0 while ( n ) : up = c * 2 + 1 a . append ( up ) if up > 0 else - 1 n -= 1 if n == 0 : break down = 1000 - up a . append ( down ) if down > 0 else - 1 n -= 1 c += 1 print ( " ▁ " . join ( map ( str , a ) ) )             for _ in range ( int ( input ( ) ) ) : create_array ( int ( input ( ) ) ) NEW_LINE


from collections import Counter   def solve ( ) : n = int ( input ( ) ) array = [ 1 for i in range ( n ) ] return array     for i in range ( int ( input ( ) ) ) : for i in solve ( ) : print ( i , end = " ▁ " ) print ( ) NEW_LINE


import java . util . * ;   public class A { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- != 0 ) { long m , s = 0 , d , x , y , a , b ; x = sc . nextInt ( ) ; for ( int i = 0 ; i < x ; i ++ ) System . out . print ( 1 + " ▁ " ) ; System . out . println ( ) ; } } }


import java . util . Scanner ;   public class OmkarAndComp {   public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int t = s . nextInt ( ) ; while ( t > 0 ) { int natasha = s . nextInt ( ) ; for ( int i = natasha ; i > 0 ; i -- ) { System . out . print ( 1 + " ▁ " ) ; } System . out . println ( ) ; t -- ; }   }   }


import java . util . Scanner ;   public class DigestThread {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int t = in . nextInt ( ) ; for ( int i = 0 ; i < t ; i ++ ) { int n = in . nextInt ( ) ; for ( int j = 0 ; j < n ; j ++ ) { System . out . print ( "1 ▁ " ) ; } System . out . println ( " " ) ; } } }


import java . util . ArrayList ; import java . util . Arrays ; import java . util . List ; import java . util . Scanner ;   public class _0589BallsOfBuma {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . nextLine ( ) ; int left = 0 ; int right = 0 ; int count = 0 ; List < Integer > length = new ArrayList < > ( ) ; List < Character > letter = new ArrayList < > ( ) ; int len = 1 ; for ( int i = 0 ; i < s . length ( ) - 1 ; i ++ ) { if ( s . charAt ( i ) == s . charAt ( i + 1 ) ) { len ++ ; } else {

li = list ( input ( ) ) i = 0j = len ( li ) - 1 while i <= j : tmp = li [ i ] res = 0 if li [ i ] != li [ j ] : print ( 0 ) exit ( ) while i <= j and li [ i ] == tmp : res += 1 i += 1 while i <= j and li [ j ] == tmp : res += 1 j -= 1 if res <= 2 and i < j : print ( 0 ) exit ( ) if res > 1 : print ( res + 1 ) else : print ( 0 ) NEW_LINE


s = input ( ) j = len ( s ) - 1 i = 0 while i <= j : c = 0 p = s [ i ] if p != s [ j ] : exit ( print ( 0 ) ) while i <= j and s [ i ] == p : i += 1 c += 1 while i <= j and s [ j ] == p : j -= 1 c += 1 if c <= 2 and i < j : exit ( print ( 0 ) ) if c > 1 : print ( c + 1 ) else : print ( 0 ) NEW_LINE


i = input ( ) i += " $ " current = i [ 0 ] mapped = [ ] c = 0 ris = 0   for x in i : if x == current : c += 1 else : mapped . append ( ( c , current ) ) current = x c = 1 n = len ( mapped ) if n % 2 == 0 : print ( 0 ) elif mapped [ n // 2 ] [ 0 ] < 2 : print ( 0 ) else : for x in range ( ( n // 2 ) + 1 ) : if mapped [ x ] [ 0 ] + mapped [ n - x - 1 ] [ 0 ] < 3 or mapped [ x ] [ 1 ] != mapped [ n - x - 1 ] [ 1 ] : print ( 0 ) break else : print ( mapped [ n // 2 ] [ 0 ] + 1 ) NEW_LINE


def run ( ) : s = input ( ) i = 0 j = len ( s ) - 1 count = 0 while i <= j : if s [ i ] != s [ j ] : return 0 c = s [ i ] count = 0 while i < len ( s ) and s [ i ] == c and i <= j : i += 1 count += 1 while j >= 0 and s [ j ] == c and i <= j : j -= 1 count += 1 if i > j : count += 1 if count >= 3 : return count else : return 0 elif count < 3 : return 0 print ( run ( ) ) NEW_LINE


if __name__ == " _ _ main _ _ " : colours = input ( ) temp = [ ] i = 0 n = len ( colours ) while i < n : current = colours [ i ] start = i while i + 1 < n and colours [ i + 1 ] == current : if i + 1 < n : i = i + 1 else : break end = i temp . append ( [ end - start + 1 , current ] ) i = i + 1 NEW_LINE


import java . io . File ; import java . io . FileInputStream ; import java . io . FileNotFoundException ; import java . io . IOException ; import java . io . PrintWriter ; import java . security . AccessControlException ; import java . util . Arrays ; import java . util . Collection ; import java . util . List ; import java . util . Scanner ; import java . util . function . Function ; import java . util . stream . Collectors ; public class _p001267B { static public void main ( final String [ ] args ) throws IOException { p001267B . _main ( args ) ; }


import java . util . * ;   public class Main { public static int solve ( String str ) { int ans , i , j ; i = 0 ; j = str . length ( ) - 1 ; while ( true ) { ans = 1 ; if ( str . charAt ( i ) != str . charAt ( j ) || i == j ) return - 1 ; while ( i < str . length ( ) - 1 ) { if ( str . charAt ( i ++ ) != str . charAt ( i ) ) break ; ans ++ ; } if ( i >= j ) return ans ; while ( j >= 1 ) { if ( str . charAt ( j -- ) != str . charAt ( j ) ) break ; ans ++ ; } if ( ans < 2 ) return - 1 ; } } public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; String str = input . next ( ) ; System . out . println ( solve ( str ) < 2 ? 0 : solve ( str ) + 1 ) ; } }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ;   public class Main { static BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ;   public static void main ( String [ ] args ) throws IOException { String text = input . readLine ( ) ;   int len = 1 ; for ( int i = 1 ; i < text . length ( ) ; i ++ ) if ( text . charAt ( i ) != text . charAt ( i - 1 ) ) len ++ ;   if ( len % 2 == 0 ) { System . out . println ( 0 ) ; return ; }   String [ ] tokens = new String [ len ] ; int current = 0 ; int last = 0 ; for ( int i = 1 ; i < text . length ( ) ; i ++ ) if ( text . charAt ( i ) != text . charAt ( i - 1 ) ) { tokens [ current ] = text . substring ( last , i ) ; last = i ; current ++ ; } tokens [ current ] = text . substring ( last ) ;   for ( int i = 0 ; i < tokens . length / 2 ; i ++ ) if ( tokens [ i ] . charAt ( 0 ) != tokens [ len - i - 1 ] . charAt ( 0 ) || tokens [ i ] . length ( ) + tokens [ len - i - 1 ] . length ( ) <= 2 ) { System . out . println ( 0 ) ; return ; }   if ( tokens [ len / 2 ] . length ( ) <= 1 ) { System . out . println ( 0 ) ; return ; }   System . out . println ( tokens [ len / 2 ] . length ( ) + 1 ) ; } }


import java . util . * ; public class BuggySorting {   public static void main ( String [ ] args ) {

n = int ( input ( ) ) if n <= 2 : print ( " - 1" ) else : for i in range ( n , 0 , - 1 ) : print ( i , end = " ▁ " ) NEW_LINE


n = int ( input ( ) ) if n == 1 or n == 2 : print ( - 1 ) else : arr = [ int ( i ) for i in range ( n , 0 , - 1 ) ] print ( * arr ) NEW_LINE


n = int ( input ( ) )   if n == 1 or n == 2 : print ( - 1 ) else : print ( * range ( n , 0 , - 1 ) ) NEW_LINE


import mathdef solve ( n ) : if n <= 2 : return [ - 1 ] return [ i for i in range ( n , 0 , - 1 ) ] def main ( ) : n = int ( input ( ) ) NEW_LINE


n = int ( input ( ) )   if n > 2 : for i in range ( n , 0 , - 1 ) : print ( i , end = ' ▁ ' ) else : print ( - 1 ) NEW_LINE


import java . util . * ; import java . io . * ; import java . math . BigInteger ; import java . text . * ; public class Main { static long mod = 1000_000_007 ; static long mod1 = 998244353 ; static boolean fileIO = false ; static boolean memory = true ; static FastScanner f ; static PrintWriter pw ; static double eps = ( double ) 1e-6 ; static int oo = ( int ) 1e7 ;


import java . util . * ;   public class Main {   public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; if ( n == 1 || n == 2 ) System . out . println ( - 1 ) ; else { for ( int i = n ; i >= 1 ; i -- ) { System . out . print ( i + " ▁ " ) ; } }   } }


import java . util . Scanner ;   public class _0709DiceTower {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; for ( int i = 0 ; i < t ; i ++ ) { long n = sc . nextLong ( ) ; if ( n <= 14 ) { System . out . println ( " NO " ) ; } else if ( n % 14 <= 6 && n % 14 >= 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } }   }

t = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) for x in a : if x > 14 and x % 14 in range ( 1 , 7 ) : print ( ' YES ' ) else : print ( ' NO ' ) NEW_LINE


t = int ( input ( ) ) s = [ int ( x ) for x in input ( ) . split ( ) ] for i in s : if i > 14 : if ( i - 1 ) % 14 == 0 : print ( ' YES ' ) elif ( i - 2 ) % 14 == 0 : print ( ' YES ' ) elif ( i - 3 ) % 14 == 0 : print ( ' YES ' ) elif ( i - 4 ) % 14 == 0 : print ( ' YES ' ) elif ( i - 5 ) % 14 == 0 : print ( ' YES ' ) elif ( i - 6 ) % 14 == 0 : print ( ' YES ' ) else : print ( ' NO ' ) else : print ( ' NO ' ) NEW_LINE


t = int ( input ( ) ) x = list ( map ( int , input ( ) . split ( ) ) ) for i in x : if i % 14 > 0 and i % 14 < 7 and i >= 15 : print ( " YES " ) else : print ( " NO " ) NEW_LINE


t = int ( input ( " " ) ) x = [ int ( n ) for n in input ( ' ' ) . split ( ' ▁ ' ) [ : t ] ] ans = [ ' NO ' , ' YES ' ]   for n in x : print ( ans [ int ( n % 14 != 0 and n % 14 < 7 and n > 14 ) ] ) NEW_LINE


n = int ( input ( ) ) li = list ( map ( int , input ( ) . split ( ) ) ) for i in li : tmp = i % 14 dc = i // 14 if 6 >= tmp >= 1 and dc >= 1 : print ( " YES " ) else : print ( " NO " ) NEW_LINE


import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; long [ ] x = new long [ t ] ; for ( int i = 0 ; i < t ; i ++ ) { x [ i ] = sc . nextLong ( ) ; } int [ ] a = { 15 , 16 , 17 , 18 , 19 , 20 } ; boolean f ; for ( int i = 0 ; i < t ; i ++ ) { if ( x [ i ] < 15 ) { System . out . println ( " NO " ) ; } else { f = false ; for ( int j = 0 ; j < 6 ; j ++ ) { if ( ( x [ i ] - a [ j ] ) % 14 == 0 ) { System . out . println ( " YES " ) ; f = true ; break ; } } if ( ! f ) System . out . println ( " NO " ) ; } } } }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ;


import java . util . * ; import java . io . * ;   public class CFA { BufferedReader br ; PrintWriter out ; StringTokenizer st ; boolean eof ; private static final long MOD = 1000L * 1000L * 1000L + 7 ; private static final int [ ] dx = { 0 , - 1 , 0 , 1 } ; private static final int [ ] dy = { 1 , 0 , - 1 , 0 } ; private static final String yes = " Yes " ; private static final String no = " No " ;   void solve ( ) { int T = nextInt ( ) ;

def min_adj ( ) : for i in range ( int ( input ( ) ) ) : length = int ( input ( ) ) lst = list ( map ( int , input ( ) . split ( ) ) ) lst . sort ( ) new = [ ] while lst != [ ] : if len ( lst ) == 1 : new . append ( lst [ 0 ] ) break new . append ( lst . pop ( ) ) new . append ( lst [ 0 ] ) lst . pop ( 0 ) print ( * new [ : : - 1 ] ) min_adj ( ) NEW_LINE


t = int ( input ( ) ) for i in range ( t ) : n = int ( input ( ) ) arr = [ int ( x ) for x in input ( ) . split ( ) ] arr . sort ( ) if ( n % 2 == 0 ) : ki = n // 2 - 1 ka = n // 2 while ( ki >= 0 and ka < n ) : print ( arr [ ka ] , arr [ ki ] , end = " ▁ " ) ka += 1 ki -= 1 print ( ) else : ki = n // 2 - 1 ka = n // 2 + 1 print ( arr [ n // 2 ] , end = " ▁ " ) while ( ki >= 0 and ka < n ) : print ( arr [ ka ] , arr [ ki ] , end = " ▁ " ) ka += 1 ki -= 1 print ( )   NEW_LINE


import sys   def answer ( n , a ) : lst = [ ] a . sort ( ) for i in range ( n // 2 ) : lst . append ( a [ i ] ) lst . append ( a [ n - i - 1 ] ) if n % 2 == 1 : lst . append ( a [ n // 2 ] ) lst . reverse ( ) return lst   def main ( ) : t = int ( input ( ) ) while t : n = int ( input ( ) ) a = [ int ( i ) for i in sys . stdin . readline ( ) . split ( ) ] print ( ' ▁ ' . join ( map ( str , answer ( n , a ) ) ) ) t -= 1 returnmain ( ) NEW_LINE


from collections import dequecases = int ( input ( ) ) while cases : cases -= 1 num = int ( input ( ) ) arr = sorted ( map ( int , input ( ) . split ( ) ) ) ans = [ ] arr = deque ( arr ) while arr : ans . append ( arr . pop ( ) )   if arr : ans . append ( arr . popleft ( ) ) print ( * ans [ : : - 1 ] ) NEW_LINE


import java . io . * ; import java . util . * ;   public class B_1339 { static PrintWriter pw = new PrintWriter ( System . out ) ;   public static void main ( String arg [ ] ) throws IOException { InputStreamReader isr = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( isr ) ; StringTokenizer token = new StringTokenizer ( " ▁ " ) ;   int i = 0 ; int j = 0 ; int n = 0 ; int arr [ ] ; int t = 0 ;   t = Integer . parseInt ( br . readLine ( ) ) ;   for ( i = 0 ; i <= t - 1 ; i ++ ) { n = Integer . parseInt ( br . readLine ( ) ) ;   arr = new int [ n ] ;   token = new StringTokenizer ( br . readLine ( ) ) ; for ( j = 0 ; j <= n - 1 ; j ++ ) arr [ j ] = Integer . parseInt ( token . nextToken ( ) ) ;   getResult ( n , arr ) ; }   pw . close ( ) ;   }   private static void getResult ( int n , int arr [ ] ) { Arrays . sort ( arr ) ;   int i = 0 ; int newarr [ ] = new int [ n ] ; int count = 0 ;   while ( i <= n - 1 ) { newarr [ i ] = arr [ n - 1 - count ] ; i ++ ; if ( i <= n - 1 ) { newarr [ i ] = arr [ count ] ; i ++ ; } count ++ ; }   for ( i = n - 1 ; i >= 0 ; i -- ) pw . print ( newarr [ i ] + " ▁ " ) ; pw . println ( ) ;     } }


import java . util . * ; import java . io . * ; public class MyClass { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int n = sc . nextInt ( ) ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; } Arrays . sort ( arr ) ; int mid = n / 2 , st = 0 ; if ( n % 2 != 0 ) { System . out . print ( arr [ mid ] + " ▁ " ) ; st += 1 ; } for ( int i = mid - 1 ; i >= 0 ; i -- ) { System . out . print ( arr [ mid + st ++ ] + " ▁ " + arr [ i ] + " ▁ " ) ; } System . out . println ( ) ; } sc . close ( ) ; } }


import java . util . * ; import java . io . * ;   public class Subtractions { public static void main ( String [ ] args ) { Scanner reader = new Scanner ( System . in ) ; int n = reader . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) { int a = reader . nextInt ( ) ; int b = reader . nextInt ( ) ; int max = Math . max ( a , b ) ; int min = Math . min ( a , b ) ; int count = 0 ; while ( min > 0 && max >= 0 && min != max ) { count += max / min ; max = max % min ;

import sys   def num_ops ( low , high ) : if high % low == 0 : return high // low else : return ( high // low ) + num_ops ( high % low , low )   def main ( ) : n = int ( sys . stdin . readline ( ) . strip ( ) ) for _ in range ( n ) : low , high = [ int ( i ) for i in sys . stdin . readline ( ) . strip ( ) . split ( ) ] print ( num_ops ( low , high ) )         if __name__ == ' _ _ main _ _ ' : main ( ) NEW_LINE


def max1 ( a , b ) : if a >= b : return a , b else : return b , adef minus ( a , b ) : p = a // b cnt = p return b , ( a - ( b * cnt ) ) , cntn = int ( input ( ) ) for _ in range ( n ) : a , b = input ( ) . split ( ) a = int ( a ) b = int ( b ) cnt = 0   while a > 0 and b > 0 : a , b = max1 ( a , b ) a , b , p = minus ( a , b ) cnt += p   print ( cnt ) NEW_LINE


n = input ( ) n1 = int ( n ) c = [ ] for i in range ( 0 , n1 ) : z4 = 0 p , q = input ( ) . split ( ) a = int ( p ) b = int ( q ) while a != 0 and b != 0 : z1 = z3 = 0 if a <= b : z = ( b / a ) z1 = int ( z ) b = b - ( z1 * a ) if b <= a and b != 0 : z2 = a / b z3 = int ( z2 ) a = a - ( z3 * b ) z4 = z4 + z1 + z3 c . append ( z4 ) l = len ( c ) for j in range ( 0 , l ) : print ( c [ j ] ) NEW_LINE


def substraction ( a , b ) : if a == 0 or b == 0 : return 0 else : if a > b : count = a // b return substraction ( a % b , b ) + count else : count = b // a return substraction ( a , b % a ) + count   t = int ( input ( ) ) lst = [ ] res = [ ] for i in range ( 0 , t ) : lst = [ int ( i ) for i in input ( ) . split ( ) ] ele = substraction ( lst [ 0 ] , lst [ 1 ] ) res . append ( ele )   for i in range ( 0 , t ) : print ( res [ i ] ) NEW_LINE


import java . io . * ; import java . util . * ; public class Solution { public static void main ( String [ ] args ) { MyScanner sc = new MyScanner ( ) ; out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ; int n = sc . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int sum = 0 ; while ( a > 0 && b > 0 ) { if ( a > b ) { sum += a / b ; a = a % b ; } else { sum += b / a ; b = b % a ; } } out . println ( sum ) ; }


import java . util . Scanner ;   public class Subtractions {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ;   for ( int i = 0 ; i < n ; i ++ ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int ans ;   if ( b < a ) { ans = a / b ; a = a % b ; while ( a != 0 && b != 0 ) { ans += ( a == 0 ) ? 0 : b / a ; b = ( a == 0 ) ? 0 : b % a ; ans += ( b == 0 ) ? 0 : a / b ; a = ( b == 0 ) ? 0 : a % b ; } } else { ans = b / a ; b = b % a ; while ( a != 0 && b != 0 ) { ans += ( b == 0 ) ? 0 : a / b ; a = ( b == 0 ) ? 0 : a % b ; ans += ( a == 0 ) ? 0 : b / a ; b = ( a == 0 ) ? 0 : b % a ; } }   System . out . println ( ans ) ; } } }


import java . util . Scanner ;   public class Subtractions {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ;   int n = sc . nextInt ( ) ;   for ( int i = 0 ; i < n ; i ++ ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; if ( b < a ) { int ans = a / b ; a = a % b ; while ( a != 0 && b != 0 ) { ans += ( a == 0 ) ? 0 : b / a ; b = ( a == 0 ) ? 0 : b % a ; ans += ( b == 0 ) ? 0 : a / b ; a = ( b == 0 ) ? 0 : a % b ; }   System . out . println ( ans ) ; } else { int ans = b / a ; b = b % a ; while ( a != 0 && b != 0 ) { ans += ( b == 0 ) ? 0 : a / b ; a = ( b == 0 ) ? 0 : a % b ; ans += ( a == 0 ) ? 0 : b / a ; b = ( a == 0 ) ? 0 : b % a ; }    System . out . println ( ans ) ; } } } }


import java . io . * ; import java . util . * ;   public class Solution {   public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int num = scan . nextInt ( ) ; for ( int i = 0 ; i < num ; i ++ ) { int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int counter = 0 ; while ( a > 0 && b > 0 ) { int smaller = Math . min ( a , b ) ; if ( a == smaller ) { counter += ( b / a ) ; b %= a ; continue ; } counter += ( a / b ) ; a %= b ; } System . out . println ( counter ) ; } } }


import java . util . Scanner ;   public class A1454 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int t = scanner . nextInt ( ) ; for ( int i = 0 ; i < t ; i ++ ) {   int n = scanner . nextInt ( ) ; if ( n == 1 ) System . out . println ( 1 ) ; else for ( int j = 1 ; j <= n ; j ++ ) { if ( j != n ) System . out . print ( ( j + 1 ) + " ▁ " ) ; else System . out . print ( 1 + " ▁ " ) ; } System . out . println ( ) ; } } }

for _ in range ( int ( input ( ) ) ) :     NEW_LINE n = int ( input ( ) )   for i in range ( 2 , n + 1 ) : print ( i , end = " ▁ " )   print ( 1 ) NEW_LINE


for s in [ * open ( 0 ) ] [ 1 : ] : n = int ( s ) ; print ( n , * range ( 1 , n ) ) NEW_LINE


t = int ( input ( ) ) NEW_LINE for i in range ( t ) : n = int ( input ( ) ) NEW_LINE l = [ ] NEW_LINE for i in range ( 1 , n + 1 ) : l . append ( i ) NEW_LINE for i in l [ 1 : ] : print ( i , end = " ▁ " ) NEW_LINE print ( l [ 0 ] ) NEW_LINE


from collections import Counter   NEW_LINE def solve ( ) : array = [ int ( i ) for i in range ( int ( input ( ) ) , 0 , - 1 ) ] NEW_LINE if len ( array ) % 2 : temp = array [ len ( array ) // 2 ] NEW_LINE array [ len ( array ) // 2 ] = 1 NEW_LINE array [ - 1 ] = temp NEW_LINE return array   for i in range ( int ( input ( ) ) ) : for NEW_LINE i in solve ( ) : print ( i , end = " ▁ " ) NEW_LINE print ( ) NEW_LINE


for i in range ( int ( input ( ) ) ) : n = int ( input ( ) ) NEW_LINE l = [ ] NEW_LINE for j in range ( n ) : l . append ( j + 1 ) NEW_LINE l . reverse ( ) NEW_LINE if n % 2 == 0 : for NEW_LINE k in l : print ( k ) else : x = n // 2 NEW_LINE l [ x ] , l [ 0 ] = l [ 0 ] , l [ x ] NEW_LINE for k in l : print ( k ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . HashMap ; import java . util . HashSet ; import java . util . LinkedList ; import java . util . List ; import java . util . Map ; import java . util . Set ;   public class Main { 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 void main ( String [ ] args ) { FastReader sc = new FastReader ( ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int a = sc . nextInt ( ) ; if ( a % 2 == 0 ) { for ( int i = a ; i > 0 ; i -- ) System . out . print ( i + " ▁ " ) ; } else { for ( int i = a ; i > a / 2 + 1 ; i -- ) System . out . print ( i + " ▁ " ) ; for ( int i = 1 ; i <= a / 2 ; i ++ ) System . out . print ( i + " ▁ " ) ; System . out . print ( a / 2 + 1 ) ; } System . out . println ( ) ; }   }   }


import java . io . * ; import java . util . * ;   public class A { public static void main ( String [ ] args ) throws IOException { FastReader fr = new FastReader ( ) ; PrintWriter pr = new PrintWriter ( new OutputStreamWriter ( System . out ) ) ; int t = fr . nextInt ( ) ;   while ( t -- > 0 ) { int n = fr . nextInt ( ) ; for ( int i = 1 ; i <= n ; i ++ ) { if ( i == n ) pr . print ( "1 ▁ " ) ; else pr . print ( ( i + 1 ) + " ▁ " ) ; } pr . println ( ) ; }   pr . close ( ) ; }   static class Pair { int x , y ; public Pair ( int x , int y ) { this . x = x ; this . y = y ; } }   static int toInt ( String s ) { return Integer . parseInt ( s ) ; }   static class FastReader { BufferedReader br ; StringTokenizer st ;   public FastReader ( ) throws FileNotFoundException { 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 ; } } }


import java . util . * ; public class permutation { public static void main ( String [ ] args ) { int t , n , i ;   Scanner sc = new Scanner ( System . in ) ;   t = sc . nextInt ( ) ;   while ( t -- > 0 ) { n = sc . nextInt ( ) ;   for ( i = 0 ; i < n ; i ++ ) { System . out . println ( ( i + 1 ) % n + 1 ) ; } } } }


import java . util . Scanner ;   public class SubsequenceHate {   public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int t = scan . nextInt ( ) ; while ( t -- > 0 ) { String s = scan . next ( ) ; int n = s . length ( ) ; char [ ] a = s . toCharArray ( ) ; int one = 0 ; int zero = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] == '0' ) { ++ zero ; } else { ++ one ; } } int c = 0 ; int k = 0 ; int res = 1000000000 ; for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] == '1' ) { ++ c ; } else { ++ k ; } res = Math . min ( res , one - c + k ) ;   } c = 0 ; k = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] == '0' ) { ++ c ; } else { ++ k ; } res = Math . min ( res , zero - c + k ) ; } System . out . println ( res ) ; } } }

import timestartTimeProblem = time . time ( )   import fileinput , sys , itertools , functools , mathfrom bisect import * from heapq import * from collections import *     MOD = 10 ** 9 + 7 NEW_LINE


for _ in range ( int ( input ( ) ) ) : s = input ( ) pre = [ int ( s [ 0 ] ) ] suf = [ int ( s [ - 1 ] ) == 0 ] n = len ( s ) for i in range ( 1 , n ) : if s [ i ] == '1' : pre . append ( pre [ - 1 ] + 1 ) else : pre . append ( pre [ - 1 ] )   if s [ n - i - 1 ] == '0' : suf . insert ( 0 , suf [ 0 ] + 1 ) else : suf . insert ( 0 , suf [ 0 ] ) NEW_LINE


import java . io . * ;   import java . util . * ; public class Solution { public static void main ( String [ ] args ) throws Exception { FastReader fr = new FastReader ( ) ; int t = fr . nextInt ( ) ; while ( t -- > 0 ) { String s = fr . next ( ) ; int n = s . length ( ) ; int one = 0 ; int zero = 0 ; for ( char c : s . toCharArray ( ) ) { if ( c == '0' ) zero ++ ; else one ++ ; } int min = Integer . MAX_VALUE ; int prefz = 0 ; int prefo = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( s . charAt ( i ) == '0' ) { prefz ++ ; } else { prefo ++ ; } if ( s . charAt ( i ) == '0' ) zero -- ; else one -- ; min = Math . min ( min , Math . min ( prefz + one , prefo + zero ) ) ; } System . out . println ( min ) ; } } public static boolean check ( String s ) {


import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner s = new Scanner ( System . in ) ; int t = s . nextInt ( ) ; while ( t -- != 0 ) { String str = s . next ( ) ; int n = str . length ( ) ; int prefix0 [ ] = new int [ n ] ; int prefix1 [ ] = new int [ n ] ; int suffix0 [ ] = new int [ n ] ; int suffix1 [ ] = new int [ n ] ; prefix0 [ 0 ] = str . charAt ( 0 ) == '0' ? 1 : 0 ; prefix1 [ 0 ] = str . charAt ( 0 ) - '0' ; for ( int i = 1 ; i < str . length ( ) ; i ++ ) { prefix0 [ i ] = prefix0 [ i - 1 ] ; prefix1 [ i ] = prefix1 [ i - 1 ] ; if ( str . charAt ( i ) == '0' ) { prefix0 [ i ] ++ ; } else { prefix1 [ i ] ++ ; } } suffix0 [ n - 1 ] = str . charAt ( n - 1 ) == '0' ? 1 : 0 ; suffix1 [ n - 1 ] = str . charAt ( n - 1 ) - '0' ; for ( int i = n - 2 ; i >= 0 ; i -- ) { suffix0 [ i ] = suffix0 [ i + 1 ] ; suffix1 [ i ] = suffix1 [ i + 1 ] ; if ( str . charAt ( i ) == '0' ) { suffix0 [ i ] ++ ; } else { suffix1 [ i ] ++ ; } } int ans = Integer . MAX_VALUE ; for ( int i = 0 ; i < n ; i ++ ) { int opt = Math . min ( n - prefix0 [ i ] - suffix1 [ i ] , n - prefix1 [ i ] - suffix0 [ i ] ) ; ans = Math . min ( ans , opt ) ; } System . out . println ( ans ) ; } } }


import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ;

t = int ( input ( ) ) for i in range ( t ) : a , b = map ( int , input ( ) . split ( ) ) if a % b == 0 : print ( " YES " ) else : print ( " NO " ) NEW_LINE


import sysimport bisectdef gcd ( a , b ) : if ( a == 0 ) : return b return gcd ( b % a , a ) def input ( ) : return sys . stdin . readline ( ) . strip ( ) def iinput ( ) : return int ( input ( ) ) def minput ( ) : return map ( int , input ( ) . split ( ) ) def listinput ( ) : return list ( map ( str , input ( ) . split ( ) ) ) for _ in range ( iinput ( ) ) : a , b = minput ( ) if a % b : print ( " NO " ) else : print ( " YES " ) NEW_LINE


from sys import stdininput = stdin . readline   t = int ( input ( ) ) for _ in range ( t ) : n , m = [ int ( x ) for x in input ( ) . split ( ) ] print ( [ " NO " , " YES " ] [ n % m == 0 ] ) NEW_LINE


def tworegularpolygons ( n , m ) : return ' YES ' if ( n % m == 0 ) else ' NO '   if __name__ == ' _ _ main _ _ ' : T = int ( input ( ) ) for t in range ( T ) : n , m = tuple ( map ( int , input ( ) . split ( ) ) ) print ( tworegularpolygons ( n , m ) ) NEW_LINE


t = int ( input ( ) ) for _ in range ( t ) : n , m = list ( map ( int , input ( ) . split ( ) ) ) if n % m == 0 : print ( ' YES ' ) else : print ( ' NO ' ) NEW_LINE


import java . util . Scanner ;   public class Main {   public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int a , b ; int t = input . nextInt ( ) ; while ( t != 0 ) { a = input . nextInt ( ) ; b = input . nextInt ( ) ; if ( a % b == 0 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } t -- ; } } }


import java . util . Scanner ;   public class A1312 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int t = scanner . nextInt ( ) ; for ( int i = 0 ; i < t ; i ++ ) { int n = scanner . nextInt ( ) ; int m = scanner . nextInt ( ) ; System . out . println ( n % m == 0 ? " YES " : " NO " ) ; } } }


import java . io . * ; import java . math . * ; import java . util . * ;     public class Main {   private static int dx [ ] = { 1 , 0 , - 1 , 0 } ; private static int dy [ ] = { 0 , - 1 , 0 , 1 } ;   private static final long INF = ( long ) Math . pow ( 10 , 16 ) ; private static final int INT_INF = Integer . MAX_VALUE ; private static final long NEG_INF = Long . MIN_VALUE ; private static final int NEG_INT_INF = Integer . MIN_VALUE ; private static final double EPSILON = 1e-10 ;   private static final long MAX = ( long ) 1e12 ; private static final long MOD = 1000000007 ;   private static final int MAXN = 200001 ; private static final int MAXA = 1000007 ; private static final int MAXLOG = 22 ; private static final double PI = Math . acos ( - 1 ) ; public static void main ( String [ ] args ) throws IOException {   InputReader in = new InputReader ( System . in ) ;

n , m = map ( int , input ( ) . split ( ) ) ans = n + 1 for i in range ( m ) : a , b = map ( int , input ( ) . split ( ) ) ans = min ( ans , b - a + 1 ) print ( ans ) arr = [ 0 ] * nput = 0 for i in range ( n ) : arr [ i ] = put put += 1 if ( put == ans ) : put = 0 print ( * arr ) NEW_LINE


from math import * from collections import * from random import * from decimal import Decimalfrom heapq import * from bisect import * import sysinput = sys . stdin . readlinesys . setrecursionlimit ( 10 ** 5 ) def lis ( ) : return list ( map ( int , input ( ) . split ( ) ) ) def ma ( ) : return map ( int , input ( ) . split ( ) ) def inp ( ) : return int ( input ( ) ) def st ( ) : return input ( ) . rstrip ( ' \n ' ) d = 100000000000 n , m = ma ( ) for i in range ( m ) : x , y = ma ( ) d = min ( d , y - x ) r = [ i for i in range ( d + 1 ) ] i = 0 print ( d + 1 ) while ( i < n ) : print ( r [ i % ( d + 1 ) ] , end = " ▁ " ) i += 1           NEW_LINE


n , m = map ( int , input ( ) . split ( ) ) mexi = 1e9 for i in range ( m ) : r , l = map ( int , input ( ) . split ( ) ) mexi = min ( mexi , l - r + 1 ) print ( mexi ) d = [ str ( j % mexi ) for j in range ( n ) ] print ( ' ▁ ' . join ( d ) ) NEW_LINE


import java . util . * ; public class Solution { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int m = in . nextInt ( ) ; int min = Integer . MAX_VALUE ; for ( int i = 0 ; i < m ; i ++ ) { int j = in . nextInt ( ) ; int k = in . nextInt ( ) ; int ans = k - j + 1 ; if ( ans < min ) min = ans ; } System . out . println ( min ) ; for ( int i = 0 ; i < n ; i ++ ) { System . out . print ( ( i % min ) + " ▁ " ) ; } } }


import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . IOException ; import java . util . StringTokenizer ; public class Solution { public static void main ( String [ ] args ) { try ( BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { StringTokenizer s = new StringTokenizer ( in . readLine ( ) ) ; int n = Integer . parseInt ( s . nextToken ( ) ) ; int m = Integer . parseInt ( s . nextToken ( ) ) ; int min_sub = Integer . MAX_VALUE ;


import java . io . * ; import java . util . * ;   public class Main { public static void main ( String [ ] args ) throws IOException {


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import static java . lang . Math . * ; import static java . lang . System . out ; import java . util . * ; import java . io . PrintStream ; import java . io . PrintWriter ; public class A { static final int mod = 1000000007 ; static final long temp = 998244353 ; static final long MOD = 1000000007 ; static final long M = ( long ) 1e9 + 7 ; static class Pair implements Comparable < Pair > { int first , second ; public Pair ( int aa , int bb ) { first = aa ; second = bb ; } public int compareTo ( Pair o ) { if ( this . second < o . second ) return - 1 ; if ( this . second > o . second ) return + 1 ; return this . first - o . first ; } } static class Tuple implements Comparable < Tuple > { long first , second , third ; public Tuple ( long first , long second , long third ) { this . first = first ; this . second = second ; this . third = third ; } public int compareTo ( Tuple o ) { return ( int ) ( o . third - this . third ) ; } } public static class DSU { int [ ] parent ; int [ ] rank ;

n = int ( input ( ) ) possible = Truefor _ in range ( n ) : s = list ( str ( input ( ) ) ) for i in range ( 0 , len ( s ) ) : if i == 0 : if s [ i ] == ' ? ' : if i + 1 != len ( s ) : s [ i ] = ' a ' if s [ i + 1 ] != ' a ' else ' b ' if s [ i + 1 ] != ' b ' else ' c ' else : s [ i ] = ' a ' elif i == len ( s ) - 1 and s [ i ] == ' ? ' : s [ i ] = ' a ' if s [ i - 1 ] != ' a ' else ' b ' if s [ i - 1 ] != ' b ' else ' c ' else : if s [ i ] == s [ i - 1 ] : possible = False break else : if s [ i ] == ' ? ' : if s [ i - 1 ] == ' a ' : s [ i ] = ' b ' if s [ i + 1 ] != ' b ' else ' c ' elif s [ i - 1 ] == ' b ' : s [ i ] = ' c ' if s [ i + 1 ] != ' c ' else ' a ' else : s [ i ] = ' b ' if s [ i + 1 ] != ' b ' else ' a ' print ( " " . join ( map ( str , s ) ) if possible else - 1 ) possible = True NEW_LINE


for _ in range ( int ( input ( ) ) ) : s = [ " - " ] + list ( input ( ) ) + [ " - " ] p = True for i in range ( 1 , len ( s ) - 1 ) : if s [ i ] == s [ i + 1 ] and s [ i ] != " ? " : print ( - 1 ) p = False break elif s [ i ] == " ? " : s [ i ] = " abc " . replace ( s [ i + 1 ] , " " ) . replace ( s [ i - 1 ] , " " ) [ 0 ] if p : print ( " " . join ( s [ 1 : ] [ : - 1 ] ) ) NEW_LINE


for _ in range ( int ( input ( ) ) ) : li = list ( map ( str , input ( ) ) ) li . append ( '0' ) li . insert ( 0 , '0' ) n = len ( li ) st = True for i in range ( 1 , n - 1 ) : if li [ i ] == li [ i + 1 ] and li [ i ] != ' ? ' : print ( - 1 ) st = False break elif li [ i ] == ' ? ' : if li [ i - 1 ] != ' a ' and li [ i + 1 ] != ' a ' : li [ i ] = ' a ' elif li [ i - 1 ] != ' b ' and li [ i + 1 ] != ' b ' : li [ i ] = ' b ' else : li [ i ] = ' c '   if st : print ( ' ' . join ( li ) . strip ( '0' ) ) NEW_LINE


T = int ( input ( ) ) for tc in range ( T ) : s = [ c for c in input ( ) ] n = len ( s ) i = 0 while ( i < n ) : if ( s [ i ] == ' ? ' ) : prv = ' d ' if i == 0 else s [ i - 1 ] nxt = ' e ' if i + 1 >= n else s [ i + 1 ] for x in [ ' a ' , ' b ' , ' c ' ] : if ( x != prv ) and ( x != nxt ) : s [ i ] = x break else : i += 1 ok = True for i in range ( n - 1 ) : if ( s [ i ] == s [ i + 1 ] ) : print ( " - 1" ) ok = False break if ( ok == True ) : print ( " " . join ( s ) ) NEW_LINE


import java . util . Scanner ;   public class _0686BeautifulString { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int c = sc . nextInt ( ) ; sc . nextLine ( ) ; while ( c > 0 ) { String s = sc . nextLine ( ) ; s = " . " + s + " . " ; boolean flag = true ; char [ ] arr = s . toCharArray ( ) ; for ( int i = 1 ; i < s . length ( ) ; i ++ ) { if ( arr [ i ] != arr [ i - 1 ] && arr [ i ] != ' ? ' ) { continue ; } if ( arr [ i ] == ' ? ' ) { for ( int x = 97 ; x < 100 ; x ++ ) { if ( arr [ i - 1 ] != x && arr [ i + 1 ] != x ) { arr [ i ] = ( char ) x ; } }


import java . util . * ; import java . io . * ;   public class HarryPotterAndHistoryOfMagic65B { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; String [ ] dates = new String [ N ] ; for ( int i = 0 ; i < N ; ++ i ) { dates [ i ] = sc . next ( ) ; }   String correctedDates = correctDates ( dates ) ; System . out . println ( correctedDates ) ; }   public static String correctDates ( String [ ] dates ) { if ( dates . length == 0 ) { return " " ; } StringBuilder sb = new StringBuilder ( " " ) ; String res = makeDateCorrect ( dates [ dates . length - 1 ] , "2011" ) ; if ( res == null ) { return " No ▁ solution " ; } sb . append ( res ) ; dates [ dates . length - 1 ] = res ;

n = int ( input ( ) ) NEW_LINE a = [ ] NEW_LINE for _ in range ( n ) : a . append ( input ( ) )   prev = "1000" NEW_LINE z = 1 NEW_LINE for i in range ( n ) : l = ' ' NEW_LINE for j in range ( 4 ) : x = list ( a [ i ] [ : ] ) NEW_LINE for k in range ( 10 ) : x [ j ] = chr ( k + ord ( '0' ) ) NEW_LINE check = ' ' . join ( r for r in x ) NEW_LINE if int ( check ) >= int ( prev ) : if NEW_LINE len ( l ) == 0 : l = check else : if int ( check ) < int ( l ) : l = check   a [ i ] = ' ' . join ( r for r in l ) NEW_LINE if int ( a [ i ] ) > 2011 or int ( a [ i ] ) < int ( prev ) : z = 0 NEW_LINE break ; NEW_LINE prev = a [ i ] NEW_LINE if z == 1 : for NEW_LINE i in a : print ( i ) NEW_LINE


import sys   n = int ( input ( ) ) NEW_LINE d = [ ] NEW_LINE for i in range ( n ) : d . append ( input ( ) ) NEW_LINE ans = [ ]   bad = ' No ▁ solution ' NEW_LINE low = 1000 NEW_LINE for date in d : lowest = 100500 NEW_LINE for i in range ( 10 ) : for NEW_LINE j in range ( i == 0 , 5 ) : changed = date [ : j ] + str ( i ) + date [ j + 1 : ] NEW_LINE if lowest > int ( changed ) >= low : lowest = int ( changed ) NEW_LINE if lowest > 2011 : print ( bad ) NEW_LINE sys . exit ( 0 ) NEW_LINE ans . append ( str ( lowest ) ) NEW_LINE low = lowest   print ( ' \n ' . join ( ans ) ) NEW_LINE


n = int ( input ( ) )   l = [ ] NEW_LINE for i in range ( n ) : l . append ( int ( input ( ) ) )   NEW_LINE def repair ( x , y , r ) : if NEW_LINE INDENT ( r == 0 ) : NEW_LINE DEDENT return x NEW_LINE z = ( x % ( 10 * r ) ) // r - ( y % ( 10 * r ) ) // r NEW_LINE if ( z == 0 ) : return repair ( x , y , r // 10 ) NEW_LINE if ( x % r >= y % r ) : NEW_LINE INDENT return x - z * r else : NEW_LINE if NEW_LINE ( z != 1 ) : NEW_LINE DEDENT return x - z * r + r NEW_LINE return x - x % r + ( x % r ) % ( 10 ** ( len ( str ( x % r ) ) - 1 ) )   y = 1000 NEW_LINE try : for NEW_LINE i in range ( n ) : l [ i ] = repair ( l [ i ] , y , 1000 ) NEW_LINE if ( l [ i ] > 2011 ) : raise Exception ( ) NEW_LINE y = l [ i ] NEW_LINE for i in l : print ( i ) except : print ( " No ▁ solution " ) NEW_LINE


n , a , ans , last = int ( input ( ) ) , [ ] , [ ] , 1000 NEW_LINE for i in range ( n ) : a . append ( input ( ) ) NEW_LINE for d in a : minoverd = 10000000 NEW_LINE for i in range ( 10 ) : for NEW_LINE j in range ( i == 0 , 5 ) : t = int ( d [ : j ] + str ( i ) + d [ j + 1 : ] ) NEW_LINE if minoverd > t >= last : minoverd = t NEW_LINE ans . append ( str ( minoverd ) ) NEW_LINE if minoverd > 2011 : break NEW_LINE last = minoverdif NEW_LINE minoverd > 2011 : print ( " No ▁ solution " ) else : print ( * ans ) NEW_LINE


import java . math . BigDecimal ; import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ;   public class Main { private static int fixDigit ( int num , int index , int digit ) { switch ( index ) { case - 1 : return num ; case 0 : return 1000 * digit + ( num % 1000 ) ; case 1 : return 100 * digit + ( num / 1000 ) * 1000 + ( num % 100 ) ; case 2 : return 10 * digit + ( num / 100 ) * 100 + ( num % 10 ) ; case 3 : return digit + ( num / 10 ) * 10 ; default : return 0 ; } }   private static int changeMinimunValue ( int oldVlaue , int minValue , int maxValue ) { int newValue = 9999 ; for ( int index = 0 ; index <= 3 ; ++ index ) { for ( int digit = 0 ; digit <= 9 ; ++ digit ) { int temp = fixDigit ( oldVlaue , index , digit ) ; if ( minValue <= temp && temp <= maxValue && temp < newValue ) { newValue = temp ; } } } return newValue ; }   public static void main ( String arg [ ] ) {


import java . util . * ;   public class HarryPotterAndTheHistoryOfMagic { static boolean valid ( int [ ] dates ) { for ( int i = 0 ; i < dates . length ; i ++ ) { if ( dates [ i ] < 1000 || dates [ i ] > 2011 ) return false ; if ( i > 0 && dates [ i - 1 ] > dates [ i ] ) return false ; } return true ; } static int changeDate ( int currentDate , int previousDate ) { char [ ] dateChars = String . valueOf ( currentDate ) . toCharArray ( ) ; int min = 9999 ; for ( int i = 0 ; i < dateChars . length ; i ++ ) { char tmp = dateChars [ i ] ; for ( char c = '0' ; c <= '9' ; c ++ ) { dateChars [ i ] = c ; int year = Integer . parseInt ( String . valueOf ( dateChars ) ) ; if ( year <= 2011 && year >= previousDate && year < min ) { min = year ; } } dateChars [ i ] = tmp ; } return min ; } public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int [ ] dates = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { dates [ i ] = in . nextInt ( ) ; } int [ ] newDates = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { newDates [ i ] = changeDate ( dates [ i ] , i == 0 ? 1000 : newDates [ i - 1 ] ) ; } if ( ! valid ( newDates ) ) { System . out . println ( " No ▁ solution " ) ; } else { for ( int date : newDates ) { System . out . println ( date ) ; } } in . close ( ) ; System . exit ( 0 ) ; } }


import java . io . * ; import java . util . * ;    public class Solution { public static void main ( String [ ] args ) throws Exception { int n = in . readInt ( ) ; int [ ] [ ] cube = new int [ 3 ] [ 6 ] ; for ( int i = 0 ; i < 3 ; i ++ ) { Arrays . fill ( cube [ i ] , - 1 ) ; } for ( int i = 0 ; i < n ; i ++ ) { cube [ i ] = in . readA ( ) ; Arrays . sort ( cube [ i ] ) ; } int [ ] digit = new int [ 10 ] ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < 6 ; j ++ ) { digit [ cube [ i ] [ j ] ] ++ ; } } for ( int i = 1 ; i < 100 ; i ++ ) { if ( ! check ( i , digit , cube ) ) { System . out . println ( i - 1 ) ; return ; } } } public static boolean check ( int x , int [ ] digit , int [ ] [ ] cube ) { int t = x , c = 0 ; while ( x > 0 ) { c ++ ; x /= 10 ; } x = t ; if ( c == 1 ) return digit [ x ] > 0 ; else { int d10 = x / 10 , d1 = x % 10 ; for ( int i = 1 ; i <= 3 ; i ++ ) { for ( int j = i + 1 ; j <= 3 ; j ++ ) { if ( ( Arrays . binarySearch ( cube [ i - 1 ] , d10 ) > - 1 && Arrays . binarySearch ( cube [ j - 1 ] , d1 ) > - 1 ) || ( Arrays . binarySearch ( cube [ i - 1 ] , d1 ) > - 1 && Arrays . binarySearch ( cube [ j - 1 ] , d10 ) > - 1 ) ) {

def check ( cubes , n ) : if len ( str ( n ) ) == 1 : for cube in cubes : if n in cube : return True return False elif len ( str ( n ) ) == 2 : for c1 in range ( len ( cubes ) ) : for c2 in range ( len ( cubes ) ) : if c1 == c2 : pass elif int ( str ( n ) [ 0 ] ) in cubes [ c1 ] and int ( str ( n ) [ 1 ] ) in cubes [ c2 ] : return True return False         n = int ( input ( ) ) cubes = [ [ int ( x ) for x in input ( ) . split ( ' ▁ ' ) ] for i in range ( n ) ] i = 1 while check ( cubes , i ) : i += 1 print ( i - 1 ) NEW_LINE


n = int ( input ( ) ) a = [ list ( map ( int , input ( ) . split ( ) ) ) for _ in range ( n ) ] for ai in a : ai . insert ( 0 , ' ' ) dic = { } for k in range ( 1 , 7 ** n ) : tmp = k i = 0 arr = [ ] while 0 < tmp : arr . append ( str ( a [ i ] [ tmp % 7 ] ) ) tmp //= 7 i += 1 arr . sort ( ) dic [ ' ' . join ( arr ) ] = True ans = 0 while ' ' . join ( sorted ( list ( str ( ans + 1 ) ) ) ) in dic : ans += 1 print ( ans ) NEW_LINE


import java . io . * ; import java . util . * ; import java . util . regex . * ; public class vk18 { public static void main ( String [ ] stp ) throws Exception { Scanner scan = new Scanner ( System . in ) ;


import java . util . Collections ; import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ;   public class B887 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int N = in . nextInt ( ) ; int [ ] [ ] cubes = new int [ N ] [ 6 ] ; for ( int cubeNo = 0 ; cubeNo < N ; cubeNo ++ ) { for ( int i = 0 ; i < 6 ; i ++ ) { cubes [ cubeNo ] [ i ] = in . nextInt ( ) ; } } Set < Integer > set = new HashSet < > ( ) ; for ( int cubeIdx1 = 0 ; cubeIdx1 < N ; cubeIdx1 ++ ) { for ( int sideIdx1 = 0 ; sideIdx1 < 6 ; sideIdx1 ++ ) { int side1 = cubes [ cubeIdx1 ] [ sideIdx1 ] ; set . add ( side1 ) ; for ( int cubeIdx2 = 0 ; cubeIdx2 < N ; cubeIdx2 ++ ) { if ( cubeIdx1 == cubeIdx2 ) { continue ; } for ( int sideIdx2 = 0 ; sideIdx2 < 6 ; sideIdx2 ++ ) { int side2 = cubes [ cubeIdx2 ] [ sideIdx2 ] ; set . add ( 10 * side1 + side2 ) ; set . add ( 10 * side2 + side1 ) ; for ( int cubeIdx3 = 0 ; cubeIdx3 < N ; cubeIdx3 ++ ) { if ( cubeIdx3 == cubeIdx1 || cubeIdx3 == cubeIdx2 ) { continue ; } for ( int sideIdx3 = 0 ; sideIdx3 < 6 ; sideIdx3 ++ ) { int side3 = cubes [ cubeIdx3 ] [ sideIdx3 ] ; set . add ( 100 * side1 + 10 * side2 + side3 ) ; set . add ( 100 * side1 + 10 * side3 + side2 ) ; set . add ( 100 * side2 + 10 * side1 + side3 ) ; set . add ( 100 * side2 + 10 * side3 + side1 ) ; set . add ( 100 * side3 + 10 * side1 + side2 ) ; set . add ( 100 * side3 + 10 * side2 + side1 ) ; } } } } } } int max = 1 ; while ( set . contains ( max ) ) { max ++ ; } System . out . println ( max - 1 ) ; }   }


import java . util . Scanner ; public class A { public static void main ( String [ ] args ) { try ( Scanner scan = new Scanner ( System . in ) ) { int n = scan . nextInt ( ) ; int m = scan . nextInt ( ) ; scan . nextLine ( ) ; boolean [ ] [ ] grid = new boolean [ n ] [ m ] ; int minJ = m , maxJ = - 1 , minI = n , maxI = - 1 ; for ( int i = 0 ; i < n ; i ++ ) { String line = scan . nextLine ( ) ; for ( int j = 0 ; j < m ; j ++ ) { grid [ i ] [ j ] = line . charAt ( j ) == ' * ' ; if ( grid [ i ] [ j ] ) { minJ = Math . min ( j , minJ ) ; maxJ = Math . max ( j , maxJ ) ; minI = Math . min ( i , minI ) ; maxI = Math . max ( i , maxI ) ; } } } for ( int i = minI ; i <= maxI ; i ++ ) { for ( int j = minJ ; j <= maxJ ; j ++ ) System . out . print ( grid [ i ] [ j ] ? ' * ' : ' . ' ) ; System . out . println ( ) ; } } } }

n , m = map ( int , input ( ) . split ( ) ) s = [ None ] * nfor i in range ( n ) : s [ i ] = input ( ) while True : if s [ 0 ] . count ( ' * ' ) != 0 : break s . pop ( 0 ) while True : if s [ len ( s ) - 1 ] . count ( ' * ' ) != 0 : break s . pop ( ) x = m - 1 d = m - 1 n = len ( s ) for i in range ( n ) : if s [ i ] . count ( ' * ' ) == 0 : continue s [ i ] = s [ i ] [ : : - 1 ] c = s [ i ] . index ( ' * ' ) if c < d : d = c s [ i ] = s [ i ] [ : : - 1 ] c = s [ i ] . index ( ' * ' ) if c < x : x = cfor i in range ( n ) : print ( s [ i ] [ x : m - d ] ) NEW_LINE


n , m = map ( int , input ( ) . split ( ) ) a = [ ] xmin , xmax = m , 0 for i in range ( n ) : a . append ( input ( ) ) for i in range ( n ) : x1 , x2 = a [ i ] . find ( " * " ) , a [ i ] . rfind ( " * " ) if x1 >= 0 : xmin = min ( xmin , x1 ) if x2 >= 0 : xmax = max ( xmax , x2 ) for i in range ( len ( a ) - 1 , - 1 , - 1 ) : if a [ i ] == " . " * m : a . pop ( i ) else : breaka = a [ : : - 1 ] for i in range ( len ( a ) - 1 , - 1 , - 1 ) : if a [ i ] == " . " * m : a . pop ( i ) else : breaka = a [ : : - 1 ] for i in range ( len ( a ) ) : print ( a [ i ] [ xmin : xmax + 1 ] ) NEW_LINE


a , b = map ( int , input ( ) . split ( ) )   cases = a   matrix = [ ] while cases : cases -= 1 matrix . append ( list ( input ( ) ) ) an = matrix [ : ] for row in matrix : if row . count ( " * " ) == 0 : an . pop ( 0 ) else : breakfor row in matrix [ : : - 1 ] : if row . count ( " * " ) == 0 : an . pop ( ) else : breakx = an [ : ]   matrix2 = [ [ x [ j ] [ i ] for j in range ( len ( x ) ) ] for i in range ( len ( x [ 0 ] ) ) ]   ans = matrix2 [ : ] for row in matrix2 : if row . count ( " * " ) == 0 : ans . pop ( 0 ) else : breakfor row in matrix2 [ : : - 1 ] : if row . count ( " * " ) == 0 : ans . pop ( ) else : break   x = ans [ : ]   matrix3 = [ [ x [ j ] [ i ] for j in range ( len ( x ) ) ] for i in range ( len ( x [ 0 ] ) ) ]   for i in matrix3 : print ( " " . join ( i ) )   NEW_LINE


n , m = map ( int , input ( ) . split ( ) )   min_i = 51 max_i = 0 min_j = 51 max_j = 0   pattern = list ( )   for i in range ( n ) : s = input ( ) pattern . append ( s )   temp = s . find ( " * " ) if temp != - 1 : min_j = min ( temp , min_j ) max_j = max ( max_j , s . rfind ( " * " ) ) min_i = min ( i , min_i ) max_i = max ( i , max_i )   for i in range ( n ) : if min_i <= i <= max_i : print ( pattern [ i ] [ min_j : max_j + 1 ] ) NEW_LINE


import java . util . * ; public class P2 {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; String s [ ] = new String [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { s [ i ] = sc . next ( ) ; } int sr = 0 ; int sco = 0 ; int lr = 0 ; int lc = 0 ; List < Integer > alr = new ArrayList < > ( ) ; List < Integer > alc = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < s [ i ] . length ( ) ; j ++ ) { if ( s [ i ] . charAt ( j ) == ' * ' ) { lr = i ; lc = j ; alr . add ( i ) ; alc . add ( j ) ;


import java . util . * ;   public class Main { public static void main ( String [ ] args ) {   Scanner sc = new Scanner ( System . in ) ; int y = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; char arr [ ] [ ] = new char [ y ] [ x ] ; for ( int i = 0 ; i < y ; i ++ ) { arr [ i ] = sc . next ( ) . toCharArray ( ) ; } int top = Integer . MAX_VALUE ; int bottom = - 1 ; int left = Integer . MAX_VALUE ; int right = - 1 ; for ( int i = 0 ; i < y ; i ++ ) { for ( int j = 0 ; j < x ; j ++ ) { if ( arr [ i ] [ j ] == ' * ' ) { top = Math . min ( i , top ) ; bottom = Math . max ( bottom , i ) ; left = Math . min ( left , j ) ; right = Math . max ( right , j ) ; } } } for ( int i = top ; i <= bottom ; i ++ ) { for ( int j = left ; j <= right ; j ++ ) { System . out . print ( arr [ i ] [ j ] ) ; } System . out . println ( ) ; } } }


import java . util . Scanner ; public class ChainReaction {   public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int [ ] [ ] beacons = new int [ n ] [ 2 ] ; for ( int i = 0 ; i < beacons . length ; i ++ ) { beacons [ i ] [ 0 ] = scanner . nextInt ( ) ; beacons [ i ] [ 1 ] = scanner . nextInt ( ) ; } scanner . close ( ) ; sortBeacons ( beacons ) ; int [ ] savedNum = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) {

import sys , os , iofrom sys import stdinfrom bisect import bisect_left , bisect_rightdef ii ( ) : return int ( input ( ) ) def li ( ) : return list ( map ( int , input ( ) . split ( ) ) ) if ( os . path . exists ( ' input . txt ' ) ) : sys . stdin = open ( " input . txt " , " r " ) ; sys . stdout = open ( " output . txt " , " w " ) else : input = io . BytesIO ( os . read ( 0 , os . fstat ( 0 ) . st_size ) ) . readline   n = ii ( ) ; l = [ ] for i in range ( n ) : l . append ( tuple ( li ( ) ) ) l . sort ( ) ; DP = [ 0 ] * ( n ) for i in range ( n ) : x = bisect_left ( l , ( l [ i ] [ 0 ] - l [ i ] [ 1 ] , 0 ) ) if x == 0 : DP [ i ] = 1 else : DP [ i ] = DP [ x - 1 ] + 1 print ( n - max ( DP ) ) NEW_LINE


import bisectn = int ( input ( ) ) b = [ ] p = [ ] a = [ ] for i in range ( n ) : a . append ( list ( map ( int , input ( ) . split ( ) ) ) ) a . sort ( ) for i in range ( n ) : b . append ( a [ i ] [ 0 ] ) p . append ( a [ i ] [ 1 ] ) dp = [ 0 ] * nfor i in range ( n ) : j = bisect . bisect_left ( b , b [ i ] - p [ i ] ) dp [ i ] = i - j + dp [ j - 1 ] ans = 10 ** 9 c = 1 for j in range ( n - 1 , - 1 , - 1 ) : ans = min ( ans , dp [ j - 1 ] + c , dp [ j ] + c - 1 ) c = c + 1 print ( ans ) NEW_LINE


import bisectfrom math import infa = [ ] b = [ ] maxi = 10 ** 6 ind = [ - 1 ] * ( maxi + 1 ) n = int ( input ( ) ) for _ in range ( n ) : x , y = map ( int , input ( ) . split ( ) ) a . append ( [ x , y ] ) b . append ( x ) a . sort ( ) b . sort ( ) for i in range ( len ( b ) ) : ind [ b [ i ] ] = idp = [ 0 ] * ( n ) dp [ 0 ] = 0 NEW_LINE


import sys , os , iofrom sys import stdinfrom math import log , gcd , ceilfrom collections import defaultdict , deque , Counterfrom heapq import heappush , heappop , heapifyfrom bisect import bisect_left , bisect_rightimport math def ii ( ) : return int ( input ( ) ) def li ( ) : return list ( map ( int , input ( ) . split ( ) ) ) if ( os . path . exists ( ' input . txt ' ) ) : sys . stdin = open ( " input . txt " , " r " ) ; sys . stdout = open ( " output . txt " , " w " ) else : input = io . BytesIO ( os . read ( 0 , os . fstat ( 0 ) . st_size ) ) . readline   no = " NO " yes = " YES "   def solve ( ) : n = ii ( ) NEW_LINE


import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int max = 1_000_005 ; int [ ] present = new int [ max ] ; for ( int i = 0 ; i < n ; i ++ ) { present [ sc . nextInt ( ) ] = sc . nextInt ( ) ; } int [ ] dp = new int [ max ] ; if ( present [ 0 ] > 0 ) { dp [ 0 ] = 1 ; } int mx = 0 ; for ( int i = 1 ; i < max ; i ++ ) { if ( present [ i ] == 0 ) { dp [ i ] = dp [ i - 1 ] ; } else { if ( present [ i ] >= i ) { dp [ i ] = 1 ; } else { dp [ i ] = dp [ i - present [ i ] - 1 ] + 1 ; } } mx = Math . max ( mx , dp [ i ] ) ; } System . out . println ( n - mx ) ; sc . close ( ) ; } }


import java . io . File ; import java . io . FileInputStream ; import java . io . FileNotFoundException ; import java . io . IOException ; import java . io . PrintStream ; import java . io . PrintWriter ; import java . security . AccessControlException ; import java . util . Arrays ; import java . util . Collection ; import java . util . List ; import java . util . Objects ; import java . util . Scanner ; import java . util . function . Function ; import java . util . stream . Collectors ; import java . util . stream . IntStream ; import java . util . stream . LongStream ; import java . util . stream . Stream ; public class _p001132B { static public void main ( final String [ ] args ) throws IOException { p001132B . _main ( args ) ; }

n = int ( input ( ) ) arr = sorted ( list ( map ( int , input ( ) . split ( ) ) ) ) summa = sum ( arr ) m = int ( input ( ) ) marr = list ( map ( int , input ( ) . split ( ) ) ) for x in marr : print ( summa - arr [ len ( arr ) - x ] ) NEW_LINE


a = int ( input ( ) ) b = list ( map ( int , input ( ) . split ( ) ) ) b . sort ( reverse = True ) res = sum ( b ) n = int ( input ( ) ) mas = list ( map ( int , input ( ) . split ( ) ) ) for k in mas : print ( res - b [ k - 1 ] ) NEW_LINE


n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) m = int ( input ( ) ) q = list ( map ( int , input ( ) . split ( ) ) )   a . sort ( ) s = sum ( a )   for i in q : print ( s - a [ - i ] )   NEW_LINE


n = int ( input ( ) ) a = [ int ( i ) for i in input ( ) . split ( ) ] m = int ( input ( ) ) a . sort ( reverse = True ) s = sum ( a ) q = [ s - a [ int ( i ) - 1 ] for i in input ( ) . split ( ) ] print ( * q , sep = ' \n ' ) NEW_LINE


n = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) add = sum ( l ) l . sort ( reverse = True ) m = int ( input ( ) ) q = list ( map ( int , input ( ) . split ( ) ) ) for i in range ( m ) : sum1 = add sum1 = sum1 - l [ q [ i ] - 1 ] print ( sum1 ) NEW_LINE


import java . util . * ; import java . lang . * ; import java . io . * ;   public class Main { PrintWriter out = new PrintWriter ( System . out ) ; BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer tok = new StringTokenizer ( " " ) ; String next ( ) throws IOException { if ( ! tok . hasMoreTokens ( ) ) { tok = new StringTokenizer ( in . readLine ( ) ) ; } return tok . nextToken ( ) ; } int ni ( ) throws IOException { return Integer . parseInt ( next ( ) ) ; } long nl ( ) throws IOException { return Long . parseLong ( next ( ) ) ; } long mod = 1000000007 ; void solve ( ) throws IOException { int n = ni ( ) ; Integer [ ] A = new Integer [ n ] ; long s = 0 ; for ( int i = 0 ; i < n ; i ++ ) { A [ i ] = ni ( ) ; s += A [ i ] ; } Arrays . sort ( A , ( a , b ) -> Integer . compare ( b , a ) ) ; int m = ni ( ) ; for ( int i = 0 ; i < m ; i ++ ) out . println ( s - A [ ni ( ) - 1 ] ) ; out . flush ( ) ; } int gcd ( int a , int b ) { return ( b == 0 ? a : gcd ( b , a % b ) ) ; } long gcd ( long a , long b ) { return ( b == 0 ? a : gcd ( b , a % b ) ) ; } long mp ( long a , long p ) { long r = 1 ; while ( p > 0 ) { if ( ( p & 1 ) == 1 ) r = ( r * a ) % mod ; p >>= 1 ; a = ( a * a ) % mod ; } return r ; } public static void main ( String [ ] args ) throws IOException { new Main ( ) . solve ( ) ; } }


import java . io . BufferedOutputStream ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . math . BigInteger ; import java . security . acl . LastOwnerException ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . Comparator ; import java . util . HashMap ; import java . util . HashSet ; import java . util . LinkedList ; import java . util . List ; import java . util . Queue ; import java . util . Set ; import java . util . SortedSet ; import java . util . StringTokenizer ; import java . util . TreeMap ; import java . util . TreeSet ; import javax . sound . midi . Soundbank ; import org . omg . PortableInterceptor . LOCATION_FORWARD ;    public class Main {   public static PrintWriter out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ;   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 [ ] nextSArray ( ) { String sr [ ] = null ; try { sr = br . readLine ( ) . trim ( ) . split ( " ▁ " ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return sr ; }   String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; }   return str ; } }


import java . io . * ; import java . util . * ;   public class Main { class E implements Comparable < E > { int v ; int id ; E ( int v , int id ) { this . v = v ; this . id = id ; }   @ Override public int compareTo ( E o ) { return Integer . compare ( v , o . v ) ; } } void solve ( ) { int n = in . nextInt ( ) ; int [ ] [ ] a = new int [ n ] [ 2 ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] [ 0 ] = in . nextInt ( ) ;

from operator import negn = int ( input ( ) ) a = [ tuple ( map ( int , input ( ) . split ( ) ) ) for i in range ( n ) ]   def check ( max_h ) : k = n // 2 b = [ ] for w , h in a : if h > max_h : if k <= 0 or w > max_h : return 1 << 60 b . append ( ( h , w ) ) k -= 1 else : b . append ( ( w , h ) ) b . sort ( key = lambda t : t [ 1 ] - t [ 0 ] ) r = 0 for w , h in b : if k > 0 and w <= max_h and h < w : r += h k -= 1 else : r += w return r * max_h   print ( min ( check ( h ) for h in range ( 1 , 1001 ) ) ) NEW_LINE


import java . util . * ;   public class CF529B { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int [ ] w = new int [ n ] ; int [ ] h = new int [ n ] ; for ( int i = 0 ; i < n ; ++ i ) { w [ i ] = scan . nextInt ( ) ; h [ i ] = scan . nextInt ( ) ; } int ans = - 1 ; for ( int H = 1 ; H <= 1000 ; ++ H ) { int W = 0 , rem = ( int ) n / 2 , ok = 1 ; List < Integer > delta = new ArrayList < > ( ) ; ; for ( int i = 0 ; i < n ; ++ i ) { if ( h [ i ] > H && w [ i ] > H ) {


import java . util . * ;   public class NextTest { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = scan . nextInt ( ) ; }   Arrays . sort ( arr ) ;   for ( int i = 1 ; i < arr [ 0 ] ; i ++ ) { if ( i < arr [ 0 ] ) { System . out . println ( i ) ; return ; } }   for ( int i = 0 ; i < n - 1 ; i ++ ) { if ( arr [ i ] != arr [ i + 1 ] - 1 ) { System . out . println ( arr [ i ] + 1 ) ; return ; } }   System . out . println ( arr [ n - 1 ] + 1 ) ; } }

n = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) l . sort ( ) i = 1 while i in l : i += 1   print ( i ) NEW_LINE


n = int ( input ( ) ) indices_str = input ( ) . split ( ) indices = [ ]   for i in range ( n ) : indices . append ( int ( indices_str [ i ] ) )   mayor = indices [ 0 ] menor = indices [ 0 ]   for i in range ( n - 1 ) : if indices [ i + 1 ] > mayor : mayor = indices [ i + 1 ] if indices [ i + 1 ] < menor : menor = indices [ i + 1 ] if menor != 1 : print ( 1 ) elif mayor == n : print ( n + 1 ) else : for i in range ( mayor - 1 ) : if not ( i + 1 ) in indices : print ( i + 1 ) break ; NEW_LINE


n = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) arr = sorted ( arr ) for i in range ( 1 , n + 1 ) : if i != arr [ i - 1 ] : print ( i ) breakelse : print ( n + 1 ) NEW_LINE


def func ( n , a ) : i = 1 while 1 : if i not in a : return i break i += 1   n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) print ( func ( n , a ) ) NEW_LINE


n = int ( input ( ) ) a = [ int ( y ) for y in input ( ) . split ( ) ] a . sort ( ) ans = - 1 for i in range ( 1 , n + 1 ) : if a [ i - 1 ] != i : ans = i breakif ans == - 1 : print ( n + 1 ) else : print ( ans ) NEW_LINE


import javax . print . attribute . HashAttributeSet ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . HashMap ; import java . util . TreeMap ;   public class Template { private static BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; static String readln ( ) throws IOException { String line = input . readLine ( ) ; return line ; }   public static void main ( String [ ] args ) throws IOException { solution ( ) ; }    public static void solution ( ) throws IOException { int n = Integer . parseInt ( readln ( ) ) ; String aa [ ] = readln ( ) . split ( " ▁ " ) ; int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = Integer . parseInt ( aa [ i ] ) ; } Arrays . sort ( a ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( i + 1 == a [ i ] ) { } else { System . out . println ( i + 1 ) ; return ; } } System . out . println ( n + 1 ) ; } }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Scanner ; import java . util . StringTokenizer ; import java . util . * ; import java . math . * ; public class er10a {


import java . util . * ; import java . lang . * ; import java . io . * ;   public class Ideone { public static void main ( String [ ] args ) throws java . lang . Exception {


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class CF27_D2_A { public static void main ( String [ ] args ) { FastScanner scanner = new FastScanner ( ) ; int n = scanner . nextInt ( ) ; int [ ] arr = new int [ 3009 ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ scanner . nextInt ( ) ] ++ ; } for ( int i = 1 ; i < arr . length ; i ++ ) { if ( arr [ i ] == 0 ) { System . out . println ( i ) ; return ; } } }   static class FastScanner { BufferedReader br ; StringTokenizer st ;   public FastScanner ( ) { 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 ; }   int [ ] nextArray ( int n ) { int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = nextInt ( ) ; } return arr ; }   Integer [ ] nextArray ( int n , boolean object ) { Integer [ ] arr = new Integer [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = nextInt ( ) ; } return arr ; } } }


import java . io . * ; import java . util . * ;   public class Solution { public static void main ( String [ ] args ) throws Exception { int [ ] nm = in . readA ( ) ; int n = nm [ 0 ] , m = nm [ 1 ] ;


def check ( a , b ) : for i in range ( 3 ) : for j in range ( 3 ) : if i == 1 and j == 1 : continue elif l [ a + i ] [ b + j ] == " . " : return False return Truedef make ( a , b ) : for i in range ( 3 ) : for j in range ( 3 ) : if i == 1 and j == 1 : continue else : l1 [ a + i ] [ b + j ] = " # " l = [ ] l1 = [ ] for _ in range ( 1 ) : n , m = map ( int , input ( ) . split ( ) ) for i in range ( n ) : l . append ( list ( input ( ) ) ) l1 . append ( [ " . " ] * m ) for i in range ( n - 2 ) : for j in range ( m - 2 ) : if check ( i , j ) : make ( i , j ) if l == l1 : print ( " YES " ) else : print ( " NO " ) NEW_LINE


n , m = map ( int , input ( ) . split ( ) ) tab = [ ] mat = [ ]   for _ in range ( n ) : tab . append ( list ( input ( ) ) )   for i in range ( n ) : mat . append ( list ( [ ' . ' ] * m ) )   n -= 2 m -= 2   for i in range ( n ) : for ii in range ( m ) : if ( tab [ i ] [ ii ] == ' # ' and tab [ i + 1 ] [ ii ] == ' # ' and tab [ i + 2 ] [ ii ] == ' # ' and tab [ i + 2 ] [ ii + 1 ] == ' # ' and tab [ i + 2 ] [ ii + 2 ] == ' # ' and tab [ i + 1 ] [ ii + 2 ] == ' # ' and tab [ i ] [ ii + 2 ] == ' # ' and tab [ i ] [ ii + 1 ] == ' # ' ) : mat [ i ] [ ii ] = ' # ' mat [ i + 1 ] [ ii ] = ' # ' mat [ i + 2 ] [ ii ] = ' # ' mat [ i + 2 ] [ ii + 1 ] = ' # ' mat [ i + 2 ] [ ii + 2 ] = ' # ' mat [ i + 1 ] [ ii + 2 ] = ' # ' mat [ i ] [ ii + 1 ] = ' # ' mat [ i ] [ ii + 2 ] = ' # '   print ( ' YES ' if ( tab == mat ) else ' NO ' ) NEW_LINE


def bidui ( ) : for i in range ( n ) : for j in range ( m ) : if mp [ i ] [ j ] != v [ i ] [ j ] : return 0 return 1   if __name__ == ' _ _ main _ _ ' : n , m = map ( int , input ( ) . strip ( ) . split ( ) ) mp = [ ] for i in range ( n ) : tmp = input ( ) . strip ( ) . split ( ) [ 0 ] mp . append ( list ( tmp ) ) v = [ [ ' . ' ] * m for i in range ( n ) ] dx = [ 0 , 0 , - 1 , - 1 , - 1 , 1 , 1 , 1 ] dy = [ - 1 , 1 , - 1 , 0 , 1 , - 1 , 0 , 1 ] for i in range ( n ) : for j in range ( m ) : tag = 1 for k in range ( 8 ) : nx = i + dx [ k ] ny = j + dy [ k ] if nx < 0 : tag = 0 break if nx >= n : tag = 0 break if ny < 0 : tag = 0 break if ny >= m : tag = 0 break NEW_LINE


import sysinput = sys . stdin . readlinen , m = map ( int , input ( ) . split ( ) ) grid = [ ] ansgrid = [ ] for i in range ( n ) : grid . append ( input ( ) ) ansgrid . append ( [ 0 ] * m ) for i in range ( n - 2 ) : for j in range ( m - 2 ) : if grid [ i ] [ j ] == ' # ' and grid [ i + 1 ] [ j ] == ' # ' and grid [ i + 2 ] [ j ] == ' # ' and grid [ i ] [ j + 1 ] == ' # ' and grid [ i ] [ j + 2 ] == ' # ' and grid [ i + 2 ] [ j + 1 ] == ' # ' and grid [ i + 2 ] [ j + 2 ] == ' # ' and grid [ i + 1 ] [ j + 2 ] == ' # ' : ansgrid [ i ] [ j ] = 1 ansgrid [ i + 1 ] [ j ] = 1 ansgrid [ i + 2 ] [ j ] = 1 ansgrid [ i + 1 ] [ j + 2 ] = 1 ansgrid [ i + 2 ] [ j + 2 ] = 1 ansgrid [ i + 2 ] [ j + 1 ] = 1 ansgrid [ i ] [ j + 2 ] = 1 ansgrid [ i ] [ j + 1 ] = 1 flag = 0 for i in range ( n ) : for j in range ( m ) : if grid [ i ] [ j ] == ' # ' and ansgrid [ i ] [ j ] == 0 or grid [ i ] [ j ] == ' . ' and ansgrid [ i ] [ j ] == 1 : flag = 1 if flag : print ( ' NO ' ) else : print ( ' YES ' ) NEW_LINE


import java . util . Scanner ;   public class Main { static int m ; static int n ; static int sx [ ] = { 1 , - 1 , 0 , 0 , - 1 , - 1 , 1 , 1 } ; static int sy [ ] = { 0 , 0 , 1 , - 1 , - 1 , 1 , 1 , - 1 } ; static char map [ ] [ ] ; static char now [ ] [ ] ; public static void main ( String [ ] args ) {


import java . util . * ; import java . io . * ; import java . math . * ; public class Solution { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; PrintWriter out = new PrintWriter ( System . out ) ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; long k1 = Long . parseLong ( st . nextToken ( ) ) ; long k2 = Long . parseLong ( st . nextToken ( ) ) ; long k3 = Long . parseLong ( st . nextToken ( ) ) ; st = new StringTokenizer ( br . readLine ( ) ) ; long t1 = Long . parseLong ( st . nextToken ( ) ) ; long t2 = Long . parseLong ( st . nextToken ( ) ) ; long t3 = Long . parseLong ( st . nextToken ( ) ) ; st = new StringTokenizer ( br . readLine ( ) ) ; int n = Integer . parseInt ( st . nextToken ( ) ) ; long [ ] a = new long [ n ] ; long [ ] b = new long [ n ] ; st = new StringTokenizer ( br . readLine ( ) ) ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = Long . parseLong ( st . nextToken ( ) ) ; b [ i ] = a [ i ] ; }

from heapq import heappush , heappopk = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE t = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE ans = 0 NEW_LINE n = int ( input ( ) ) NEW_LINE l = sorted ( list ( map ( int , input ( ) . split ( ) ) ) ) NEW_LINE X = list ( l ) NEW_LINE for i in range ( 3 ) : for NEW_LINE j in range ( n ) : NEW_LINE if j >= k [ i ] and X [ j - k [ i ] ] > X [ j ] : X [ j ] += X [ j - k [ i ] ] - X [ j ] NEW_LINE X [ j ] += t [ i ] NEW_LINE for i in range ( n ) : ans = max ( ans , X [ i ] - l [ i ] ) NEW_LINE print ( ans ) NEW_LINE