import sys   input = sys . stdin . readlinefrom collections import deque    def bfs ( root ) : visit = [ 0 ] * ( n + 1 ) queue = [ root , - 1 ] queue = deque ( queue ) visit [ root ] = 1 d = 0 while len ( queue ) != 1 : element = queue . popleft ( ) if element == - 1 : queue . append ( - 1 ) d += 1 continue visit [ element ] = 1 store [ element ] = d for i in r_graph [ element ] : if not visit [ i ] : queue . append ( i ) visit [ i ] = 1    n , m = map ( int , input ( ) . split ( ) ) r_graph = [ [ ] for i in range ( n + 1 ) ] graph = [ [ ] for i in range ( n + 1 ) ] for i in range ( m ) : a , b = map ( int , input ( ) . split ( ) ) graph [ a ] . append ( b ) r_graph [ b ] . append ( a ) k = int ( input ( ) ) c = list ( map ( int , input ( ) . split ( ) ) ) store = [ 0 ] * ( n + 1 ) bfs ( c [ - 1 ] ) maxi , mini , count = 0 , 0 , 0f or i in range ( k - 1 ) : if ( store [ c [ i ] ] < store [ c [ i + 1 ] ] + 1 ) : maxi += 1 mini += 1 else : count = 0 for j in graph [ c [ i ] ] : if ( store [ c [ i ] ] == store [ j ] + 1 ) : count += 1 if ( count >= 2 ) : maxi += 1 print ( mini , maxi )

import java . util . * ; import java . io . * ;   public class Main { public static void main ( String [ ] args ) throws IOException { FastScanner in = new FastScanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; new Main ( ) . run ( in , out ) ; out . close ( ) ; }   int N ; List < Integer > [ ] adj ; List < Integer > [ ] radj ; int M ; int [ ] dist ; int [ ] distCount ;   int K ; int [ ] path ; void run ( FastScanner in , PrintWriter out ) {   N = in . nextInt ( ) ; adj = new List [ N + 1 ] ; radj = new List [ N + 1 ] ; dist = new int [ N + 1 ] ; multipleOptionsForShortestPath = new boolean [ N + 1 ] ; distCount = new int [ N + 1 ] ; for ( int i = 0 ; i <= N ; i ++ ) { adj [ i ] = new ArrayList < > ( ) ; radj [ i ] = new ArrayList < > ( ) ; }   M = in . nextInt ( ) ; for ( int i = 0 ; i < M ; i ++ ) { int u = in . nextInt ( ) ; int v = in . nextInt ( ) ;   adj [ u ] . add ( v ) ; radj [ v ] . add ( u ) ; }   K = in . nextInt ( ) ; path = new int [ K ] ; for ( int i = 0 ; i < K ; i ++ ) path [ i ] = in . nextInt ( ) ;    bfs ( path [ K - 1 ] ) ;   int min = 0 ; int max = 0 ;   for ( int i = 1 ; i < K ; i ++ ) { int prevDist = dist [ path [ i - 1 ] ] ; int currDist = dist [ path [ i ] ] ; if ( prevDist - 1 != currDist ) { min ++ ; max ++ ; } else {

import java . util . * ; import java . io . * ;   public class Main { public static void main ( String [ ] args ) throws IOException { FastScanner in = new FastScanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; new Main ( ) . run ( in , out ) ; out . close ( ) ; }   int N ; List < Integer > [ ] adj ; List < Integer > [ ] radj ; int M ; int [ ] dist ; int [ ] distCount ;   int K ; int [ ] path ; void run ( FastScanner in , PrintWriter out ) {   N = in . nextInt ( ) ; adj = new List [ N + 1 ] ; radj = new List [ N + 1 ] ; dist = new int [ N + 1 ] ; distCount = new int [ N + 1 ] ; for ( int i = 0 ; i <= N ; i ++ ) { adj [ i ] = new ArrayList < > ( ) ; radj [ i ] = new ArrayList < > ( ) ; }   M = in . nextInt ( ) ; for ( int i = 0 ; i < M ; i ++ ) { int u = in . nextInt ( ) ; int v = in . nextInt ( ) ;   adj [ u ] . add ( v ) ; radj [ v ] . add ( u ) ; }   K = in . nextInt ( ) ; path = new int [ K ] ; for ( int i = 0 ; i < K ; i ++ ) path [ i ] = in . nextInt ( ) ;    bfs ( path [ K - 1 ] ) ;   int min = 0 ; int max = 0 ;   for ( int i = 1 ; i < K ; i ++ ) { int prevDist = dist [ path [ i - 1 ] ] ; int currDist = dist [ path [ i ] ] ; if ( prevDist - 1 != currDist ) { min ++ ; max ++ ; } else {

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

import sys   input = sys . stdin . readlinefrom collections import deque     def bfs ( root ) : visit = [ 0 ] * ( n + 1 ) queue = [ root , - 1 ] queue = deque ( queue ) visit [ root ] = 1 d = 0 while len ( queue ) != 1 : element = queue . popleft ( ) if element == - 1 : queue . append ( - 1 ) d += 1 continue visit [ element ] = 1 store [ element ] = d for i in r_graph [ element ] : if not visit [ i ] : queue . append ( i ) visit [ i ] = 1     n , m = map ( int , input ( ) . split ( ) ) r_graph = [ [ ] for i in range ( n + 1 ) ] graph = [ [ ] for i in range ( n + 1 ) ] for i in range ( m ) : a , b = map ( int , input ( ) . split ( ) ) graph [ a ] . append ( b ) r_graph [ b ] . append ( a ) k = int ( input ( ) ) c = list ( map ( int , input ( ) . split ( ) ) ) store = [ 0 ] * ( n + 1 ) bfs ( c [ - 1 ] ) maxi , mini , count = 0 , 0 , 0 for i in range ( k - 1 ) : if ( store [ c [ i ] ] < store [ c [ i + 1 ] ] + 1 ) : maxi += 1 mini += 1 else : count = 0 for j in graph [ c [ i ] ] : if ( store [ c [ i ] ] == store [ j ] + 1 ) : count += 1 if ( count >= 2 ) : maxi += 1 print ( mini , maxi ) NEW_LINE

from collections import defaultdictfrom collections import deque   n , m = map ( int , input ( ) . split ( ) ) adj = defaultdict ( list ) rev = defaultdict ( list ) dist = { } for _ in range ( m ) : u , v = map ( int , input ( ) . split ( ) ) adj [ u ] . append ( v ) rev [ v ] . append ( u )   k = int ( input ( ) ) path = list ( map ( int , input ( ) . split ( ) ) )   dt = { }     def bfs ( t ) : q = deque ( [ t ] ) dt [ t ] = 0   while q : c = q . popleft ( ) for y in rev [ c ] : if y not in dt : dt [ y ] = dt [ c ] + 1 q . append ( y )     min_rebuild = 0 max_rebuild = 0 bfs ( path [ k - 1 ] )   for i in range ( 1 , k - 1 ) : v = path [ i - 1 ] u = path [ i ]   if dt [ u ] + 1 > dt [ v ] : min_rebuild += 1 max_rebuild += 1   elif dt [ u ] + 1 == dt [ v ] : for w in adj [ v ] : if u != w and dt [ u ] == dt [ w ] : max_rebuild += 1 break     print ( min_rebuild , max_rebuild ) NEW_LINE

import sysinput = sys . stdin . buffer . readline NEW_LINE

from types import GeneratorType   INF = 1e10     def bootstrap ( f , stack = [ ] ) : def wrappedfunc ( * args , ** kwargs ) : if stack : return f ( * args , ** kwargs ) else : to = f ( * args , ** kwargs ) while True : if type ( to ) is GeneratorType : stack . append ( to ) to = next ( to ) else : stack . pop ( ) if not stack : break to = stack [ - 1 ] . send ( to ) return to   return wrappedfunc     class Graph :   def __init__ ( self , V ) : self . V = V self . adj = [ [ ] for i in range ( V ) ]   def addEdge ( self , v , w ) : self . adj [ v ] . append ( w )     import sys   input = sys . stdin . readlinen , m = list ( map ( int , input ( ) . split ( ) ) ) G = Graph ( n ) G_transpose = Graph ( n ) for _ in range ( m ) : u , v = list ( map ( int , input ( ) . split ( ) ) ) G . addEdge ( u - 1 , v - 1 ) G_transpose . addEdge ( v - 1 , u - 1 ) minimums = [ 0 for _ in range ( n ) ] mini = [ 0 for _ in range ( n ) ]   from collections import dequedef BFS_SP ( graph , start ) : explored = set ( ) queue = deque ( [ start ] ) dz = set ( )   while queue : node = queue . popleft ( )   if node not in explored : neighbours = graph . adj [ node ] NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . StringTokenizer ;   public class A { public static void main ( String [ ] args ) { FastReader ( ) ; int t = 1 ; while ( t > 0 ) { solve ( ) ; -- t ; } write . flush ( ) ; write . close ( ) ; } static void solve ( ) { int n = ni ( ) , k = ni ( ) ; int f [ ] = new int [ n ] ; int t [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; ++ i ) { f [ i ] = ni ( ) ; t [ i ] = ni ( ) ; } long max = 0 ; if ( t [ 0 ] > k ) { max = f [ 0 ] - t [ 0 ] + k ; } else { max = f [ 0 ] ; } for ( int i = 0 ; i < n ; ++ i ) { if ( t [ i ] > k ) { long p = f [ i ] - t [ i ] + k ; if ( p > max ) { max = p ; } } else { long p = f [ i ] ; if ( p > max ) { max = p ; } } } out ( max ) ; }

import java . lang . * ; import java . util . * ; import java . io . * ;   public class _temp2 { public static void main ( String [ ] args ) throws NumberFormatException , IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] st = br . readLine ( ) . split ( " ▁ " ) ; int n = Integer . parseInt ( st [ 0 ] ) ; int k = Integer . parseInt ( st [ 1 ] ) ; int [ ] a = new int [ n ] ; int [ ] b = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { st = br . readLine ( ) . split ( " ▁ " ) ; a [ i ] = Integer . parseInt ( st [ 0 ] ) ; b [ i ] = Integer . parseInt ( st [ 1 ] ) ; } int count = Integer . MIN_VALUE ; for ( int i = 0 ; i < n ; i ++ ) { if ( b [ i ] > k ) { count = Math . max ( count , a [ i ] - b [ i ] + k ) ; } else { count = Math . max ( count , a [ i ] ) ; } } System . out . println ( count ) ; } }

import java . util . * ; import java . math . * ;   public class gfg { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int maxJoy = - 1000000000 ; for ( int i = 0 ; i < n ; i ++ ) { int f = sc . nextInt ( ) ; int t = sc . nextInt ( ) ; if ( t < k ) { if ( maxJoy < f ) maxJoy = f ; } else { if ( maxJoy < ( f - ( t - k ) ) ) maxJoy = f - ( t - k ) ; } } System . out . println ( maxJoy ) ; } }

import sysinput = sys . stdin . readlinerr = lambda : sys . stdin . readline ( ) . strip ( ) restaurants , givenTime = map ( int , rr ( ) . split ( ) ) restDetails = [ tuple ( map ( int , rr ( ) . split ( ) ) ) for _ in range ( restaurants ) ] restDetails . sort ( )   ans = - 10 ** 69 for f , t in restDetails : cur = f if t > givenTime : cur = f - ( t - givenTime ) ans = max ( cur , ans ) print ( ans ) NEW_LINE

cases , k = map ( int , input ( ) . split ( ) ) mx = float ( " - inf " ) while cases : cases -= 1 fi , ti = map ( int , input ( ) . split ( ) ) if ti > k : mx = max ( fi + k - ti , mx ) else : mx = max ( mx , fi )   print ( mx ) NEW_LINE

import sysfrom os import pathif ( path . exists ( ' input . txt ' ) and path . exists ( ' output . txt ' ) ) : sys . stdout = open ( ' output . txt ' , ' w ' ) sys . stdin = open ( ' input . txt ' , ' r ' )   NEW_LINE

n = [ int ( x ) for x in input ( ) . split ( ) ] t = n [ 1 ] j = [ ] for i in range ( n [ 0 ] ) : x = [ int ( x ) for x in input ( ) . split ( ) ] if x [ 1 ] > t : j . append ( ( x [ 0 ] - ( x [ 1 ] - t ) ) ) else : j . append ( x [ 0 ] )   print ( max ( j ) ) NEW_LINE

n , k = map ( int , input ( ) . split ( ) )   joy = int ( )   for i in range ( n ) :   f , t = map ( int , input ( ) . split ( ) )   if i == 0 : if t > k : joy = f - t + k   else : joy = f   else : if t > k : joy = max ( joy , f - t + k )   else : joy = max ( joy , f )   print ( joy ) NEW_LINE


import java . lang . * ; import java . util . * ; import java . util . stream . Collectors ; import java . io . * ; public class Cat_Furrier { public static void main ( String [ ] args ) {

import java . util . * ; import java . io . * ; import java . math . * ;   public class Practice   { static FastReader sc = new FastReader ( ) ; static int mod = ( int ) Math . pow ( 10 , 9 ) + 7 ; public static void main ( String [ ] args ) {

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

n , m = map ( int , input ( ) . split ( ) ) a = { input ( ) for _ in range ( n ) } b = { input ( ) for _ in range ( m ) } u = len ( a . intersection ( b ) ) print ( " NO " ) if m - u + u // 2 >= n - u + ( u + 1 ) // 2 else print ( " YES " ) NEW_LINE

n , m = map ( int , input ( ) . split ( ) ) a = { input ( ) for x in range ( n ) } b = { input ( ) for y in range ( m ) } t = n + m - len ( a | b ) print ( ' YES ' if n + t % 2 > m else ' NO ' )   NEW_LINE

temp = input ( ) . split ( " ▁ " ) n = int ( temp [ 0 ] ) m = int ( temp [ 1 ] )   nli = [ ] mli = [ ]   for _ in range ( n ) : nli . append ( input ( ) )   for _ in range ( m ) : mli . append ( input ( ) )   res = n - mcount = 0 for x in mli : if x in nli : count += 1   res = res + ( count % 2 ) if res > 0 : print ( " YES " )   else : print ( " NO " ) NEW_LINE

def solve ( ) : n , m = [ int ( x ) for x in input ( ) . split ( ) ] if m > n : print ( " NO " ) return elif n > m : print ( " YES " ) return a = [ ] for _ in range ( n ) : a . append ( input ( ) ) a . sort ( ) counter = 0 for _ in range ( m ) : if input ( ) in a : counter += 1 if counter & 1 : if n + 1 > m : print ( " YES " ) else : print ( " NO " )   else : if m >= n : print ( " NO " ) else : print ( " YES " )     solve ( ) 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 maxN = ( int ) 1e6 ;

import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . * ;   public class main {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x [ ] = new int [ 8 ] ; int y [ ] = new int [ 8 ] ; for ( int i = 0 ; i < 8 ; ++ i ) { x [ i ] = sc . nextInt ( ) ; y [ i ] = sc . nextInt ( ) ; }   TreeSet < Integer > setX = new TreeSet < > ( ) ; TreeSet < Integer > setY = new TreeSet < > ( ) ; for ( int i = 0 ; i < 8 ; ++ i ) { setX . add ( x [ i ] ) ; setY . add ( y [ i ] ) ; }   if ( setX . size ( ) != 3 || setY . size ( ) != 3 ) { System . out . println ( " ugly " ) ; return ; }   Integer [ ] arrX = setX . toArray ( new Integer [ 3 ] ) ; Integer [ ] arrY = setY . toArray ( new Integer [ 3 ] ) ;   for ( int i = 0 ; i < 3 ; ++ i ) { for ( int j = 0 ; j < 3 ; ++ j ) { boolean found = false ; for ( int k = 0 ; k < 8 ; ++ k ) { if ( arrX [ i ] == x [ k ] && arrY [ j ] == y [ k ] ) { found = true ; break ; } }   if ( found == ( i == 1 && j == 1 ) ) { System . out . println ( " ugly " ) ; return ; } } }   System . out . println ( " respectable " ) ; } }

import java . util . Arrays ; import java . util . Scanner ;   public class EightPointSets { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] x = new int [ 8 ] ; int [ ] y = new int [ 8 ] ; for ( int i = 0 ; i < 8 ; i ++ ) { x [ i ] = sc . nextInt ( ) ; y [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < 8 ; i ++ ) { for ( int j = i + 1 ; j < 8 ; j ++ ) { if ( x [ i ] == x [ j ] && y [ i ] == y [ j ] ) { System . out . println ( " ugly " ) ; return ; } } } int [ ] cntx = new int [ 1000000 + 1 ] ; int [ ] cnty = new int [ 1000000 + 1 ] ; for ( int i = 0 ; i < 8 ; i ++ ) { cntx [ x [ i ] ] ++ ; cnty [ y [ i ] ] ++ ; } boolean isRespectable = false ; Arrays . sort ( x ) ; Arrays . sort ( y ) ; if ( cntx [ x [ 0 ] ] == 3 && cntx [ x [ 3 ] ] == 2 && cntx [ x [ 5 ] ] == 3 && cnty [ y [ 0 ] ] == 3 && cnty [ y [ 3 ] ] == 2 && cnty [ y [ 5 ] ] == 3 ) { isRespectable = true ; } System . out . println ( isRespectable ? " respectable " : " ugly " ) ; } }

from sys import stdin , stdoutnmbr = lambda : int ( stdin . readline ( ) ) lst = lambda : list ( map ( int , stdin . readline ( ) . split ( ) ) ) for _ in range ( 1 ) : NEW_LINE

x , y = [ ] , [ ] xx , yy = { } , { } for i in range ( 8 ) : a , b = map ( int , input ( ) . split ( ) ) x . append ( a ) y . append ( b ) if a not in xx : xx [ a ] = [ b ] else : xx [ a ] . append ( b ) if b not in yy : yy [ b ] = [ a ] else : yy [ b ] . append ( a ) if len ( set ( x ) ) != 3 or len ( set ( y ) ) != 3 : print ( ' ugly ' ) exit ( ) xxx , yyy = sorted ( set ( x ) ) , sorted ( set ( y ) ) if set ( xx [ xxx [ 1 ] ] ) != { yyy [ 0 ] , yyy [ 2 ] } : print ( ' ugly ' ) exit ( ) if set ( yy [ yyy [ 1 ] ] ) != { xxx [ 0 ] , xxx [ 2 ] } : print ( ' ugly ' ) exit ( ) if len ( set ( xx [ xxx [ 0 ] ] ) ) != 3 or 3 != len ( set ( xx [ xxx [ 2 ] ] ) ) or len ( set ( yy [ yyy [ 0 ] ] ) ) != 3 or 3 != len ( set ( yy [ yyy [ 2 ] ] ) ) : print ( ' ugly ' ) exit ( ) print ( ' respectable ' ) NEW_LINE

a = [ ] xDistinct = [ ] yDistinct = [ ]   for i in range ( 0 , 8 ) : [ n1 , n2 ] = map ( int , input ( ) . split ( ) ) a . append ( [ n1 , n2 ] )   if ( n1 not in xDistinct ) : xDistinct . append ( n1 )   if ( n2 not in yDistinct ) : yDistinct . append ( n2 )     countDistinctX = len ( xDistinct ) countDistinctY = len ( yDistinct )   if ( countDistinctX != 3 and countDistinctY != 3 ) : print ( " ugly " ) exit ( )   xDistinct . sort ( ) yDistinct . sort ( ) a . sort ( )   index = 0   for i in range ( 3 ) : for j in range ( 3 ) : if i == j == 1 : continue   if xDistinct [ i ] != a [ index ] [ 0 ] or yDistinct [ j ] != a [ index ] [ 1 ] : print ( ' ugly ' ) exit ( )   index = index + 1   print ( ' respectable ' ) NEW_LINE

class coor : def __init__ ( self , x , y ) : self . x = x self . y = y def __lt__ ( self , other ) : if ( self . x < other . x ) : return True elif ( self . x > other . x ) : return False else : if ( self . y < other . y ) : return True else : return Falsea = [ ] first = set ( ) second = set ( ) for i in range ( 0 , 8 ) : x , y = ( map ( int , input ( ) . split ( ) ) ) first . add ( x ) second . add ( y ) a . append ( coor ( x , y ) )   NEW_LINE


import java . io . * ; import java . util . * ;   public class prog { static class pr { int id , w ;   pr ( int id , int w ) { this . id = id ; this . w = w ; } }   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; int n = in . nextInt ( ) ; pr mas [ ] = new pr [ n ] ; for ( int i = 0 ; i < n ; i ++ ) mas [ i ] = new pr ( i + 1 , in . nextInt ( ) ) ; Arrays . sort ( mas , new Comparator < pr > ( ) { public int compare ( pr a , pr b ) { return a . w - b . w ; } } ) ; String s = in . next ( ) ; Stack < Integer > order = new Stack < > ( ) ; int id = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == '1' ) out . print ( order . pop ( ) + " ▁ " ) ; else { out . print ( mas [ id ] . id + " ▁ " ) ; order . push ( mas [ id ++ ] . id ) ; } } in . close ( ) ; out . close ( ) ; } }

import java . io . * ; import java . math . * ; import java . security . * ; import java . text . * ; import java . util . * ; import javafx . util . Pair ;   public class CodeForce { static BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; static StringBuilder sb = new StringBuilder ( ) ;   static boolean flag = false ; static int gcd ( int a , int b ) { if ( b == 0 ) return a ; return gcd ( b , a % b ) ; } static int next ( String [ ] sr , int ind ) { return Integer . parseInt ( sr [ ind ] ) ; }   public static void main ( String [ ] args ) throws IOException {

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

n = int ( input ( ) ) a = [ int ( a ) for a in input ( ) . split ( ) ]   code = [ ]   for i in range ( 1 , n + 1 ) : d = dict ( x = a [ i - 1 ] , y = i ) code . append ( d ) code = sorted ( code , key = lambda i : i [ " x " ] , reverse = True ) intro = [ ] extro = [ ]   for i in range ( 1 , n + 1 ) : intro . append ( code [ i - 1 ] [ ' y ' ] )   inp = input ( )   for i in inp : if i == '0' : intro_seat = intro . pop ( ) print ( intro_seat , end = ' ▁ ' ) extro . append ( intro_seat )   else : print ( extro . pop ( ) , end = ' ▁ ' )   print ( ) NEW_LINE

z , zz = input , lambda : list ( map ( int , z ( ) . split ( ) ) ) fast = lambda : stdin . readline ( ) . strip ( ) zzz = lambda : [ int ( i ) for i in fast ( ) . split ( ) ] szz , graph , mod , szzz = lambda : sorted ( zz ( ) ) , { } , 10 ** 9 + 7 , lambda : sorted ( zzz ( ) ) from string import * from re import * from collections import * from queue import * from sys import * from collections import * from math import * from heapq import * from itertools import * from bisect import * from collections import Counter as ccfrom math import factorial as ffrom bisect import bisect as bsfrom bisect import bisect_left as bslfrom itertools import accumulate as acdef lcd ( xnum1 , xnum2 ) : return ( xnum1 * xnum2 // gcd ( xnum1 , xnum2 ) ) def prime ( x ) : p = ceil ( x ** .5 ) + 1 for i in range ( 2 , p ) : if ( x % i == 0 and x != 2 ) or x == 0 : return 0 return 1 def dfs ( u , visit , graph ) : visit [ u ] = 1 for i in graph [ u ] : if not visit [ i ] : dfs ( i , visit , graph ) def output ( answer ) : stdout . write ( str ( answer ) ) NEW_LINE

from _collections import dequen = int ( input ( ) ) m = list ( map ( int , input ( ) . split ( ) ) ) a = [ ] b = deque ( ) i = 1 for x in m : a . append ( ( x , i ) ) i += 1 a . sort ( key = lambda p : - p [ 0 ] ) s = input ( ) ans = [ ] for x in s : if x == "1" : v = b . pop ( ) ans . append ( v [ 1 ] ) else : v = a . pop ( ) ans . append ( v [ 1 ] ) b . append ( v ) print ( * ans ) NEW_LINE

from sys import stdin , stdoutnmbr = lambda : int ( stdin . readline ( ) ) lst = lambda : list ( map ( int , stdin . readline ( ) . split ( ) ) ) for _ in range ( 1 ) : n = nmbr ( ) l = sorted ( zip ( lst ( ) , range ( n ) ) ) p = 0 ; ans = [ 0 ] * ( 2 * n ) st = [ 0 ] * n ; ln = 0 s = input ( ) for i in range ( 2 * n ) : ch = s [ i ] if ch == '0' : st [ ln ] = p ans [ i ] = l [ p ] [ 1 ] + 1 ln += 1 p += 1 else : ans [ i ] = l [ st [ ln - 1 ] ] [ 1 ] + 1 ln -= 1 print ( * ans ) NEW_LINE

from collections import dequen = int ( input ( ) ) orderedli = list ( map ( int , input ( ) . split ( " ▁ " ) ) )     indexof = { } for i , x in enumerate ( orderedli ) : indexof [ x ] = i + 1   sortedli = list ( sorted ( orderedli ) ) i = 0   s = input ( )   st = deque ( )   for x in s : if x == "0" : st . append ( sortedli [ i ] ) print ( indexof [ sortedli [ i ] ] , end = " ▁ " ) i += 1 else : NEW_LINE


# include < bits / stdc ++ . h > using namespace std ;  # define ll long long

import java . util . * ;   public class WarriorAndArcher {   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 ) ; int ans = Integer . MAX_VALUE ; for ( int i = 0 ; i + n / 2 < n ; i ++ ) { ans = Math . min ( arr [ i + n / 2 ] - arr [ i ] , ans ) ; } System . out . println ( ans ) ; } }

import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . StringTokenizer ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . InputStream ;   public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskA solver = new TaskA ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; }   static class TaskA { public void solve ( int testNumber , InputReader in , PrintWriter out ) { int n = in . nextInt ( ) ; Integer [ ] x = new Integer [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { x [ i ] = in . nextInt ( ) ; } Arrays . sort ( x ) ; int m = n / 2 ; int ans = Integer . MAX_VALUE ; for ( int i = 0 ; i < m ; i ++ ) { ans = Math . min ( ans , x [ i + m ] - x [ i ] ) ; } out . println ( ans ) ; }   }   static class InputReader { private StringTokenizer tokenizer ; private BufferedReader reader ;   public InputReader ( InputStream inputStream ) { reader = new BufferedReader ( new InputStreamReader ( inputStream ) ) ; }   private void fillTokenizer ( ) { if ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } } }   public String next ( ) { fillTokenizer ( ) ; return tokenizer . nextToken ( ) ; }   public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   } }

import java . io . * ; import java . util . * ;   public class Main {    public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ;   int N = in . nextInt ( ) ;   int [ ] vals = new int [ N ] ;   for ( int i = 0 ; i < N ; i ++ ) vals [ i ] = in . nextInt ( ) ;   Arrays . sort ( vals ) ;   if ( N == 2 ) { System . out . println ( vals [ 1 ] - vals [ 0 ] ) ; return ; }   int interval = N / 2 ;   int min1 = 0 ; int min2 = 0 ; int min = 0 ;   for ( int i = 0 ; i + interval < N ; i ++ ) { if ( min == 0 || vals [ i + interval ] - vals [ i ] < min ) { min1 = i ; min2 = i + interval ; min = vals [ i + interval ] - vals [ i ] ;   } }    System . out . println ( min ) ;    } }

n = int ( input ( ) )   x = sorted ( list ( map ( int , input ( ) . split ( ) ) ) )   print ( min ( [ x [ i + n // 2 ] - x [ i ] for i in range ( n // 2 ) ] ) )             NEW_LINE


import java . io . * ;   public class Main { static final int N = 110 ; static int n , m ; static String [ ] input ; static char [ ] [ ] g = new char [ N ] [ N ] ; static BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; static BufferedWriter bw = new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ;   public static void main ( String [ ] args ) throws IOException { input = br . readLine ( ) . split ( " ▁ " ) ; n = Integer . parseInt ( input [ 0 ] ) ; m = Integer . parseInt ( input [ 1 ] ) ; for ( int i = 0 ; i < n ; ++ i ) { g [ i ] = br . readLine ( ) . toCharArray ( ) ; } char t = ' ▁ ' ; boolean flag = true ; for ( int i = 0 ; i < n ; ++ i ) { if ( i != 0 && t == g [ i ] [ 0 ] ) { flag = false ; break ; } t = g [ i ] [ 0 ] ; for ( int j = 1 ; j < m ; ++ j ) { if ( t != g [ i ] [ j ] ) { flag = false ; break ; } } if ( ! flag ) { break ; } } bw . write ( flag ? " YES " : " NO " ) ; bw . close ( ) ; } }

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

public class Flag { public static void main ( String [ ] args ) { try ( java . util . Scanner sc = new java . util . Scanner ( System . in ) ) { int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ;   int [ ] [ ] mm = new int [ n ] [ m ] ;   for ( int i = 0 ; i < n ; i ++ ) { String [ ] aa = sc . next ( ) . split ( " " ) ; for ( int j = 0 ; j < aa . length ; j ++ ) { mm [ i ] [ j ] = Integer . parseInt ( aa [ j ] ) ; } }   boolean isOK = true ;   for ( int i = 1 ; i < n ; i ++ ) { for ( int j = 1 ; j < m ; j ++ ) { if ( mm [ i - 1 ] [ j ] == mm [ i ] [ j ] ) { isOK = false ; } } }   if ( isOK ) { for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 1 ; j < m ; j ++ ) { if ( mm [ i ] [ j - 1 ] != mm [ i ] [ j ] ) { isOK = false ; } } } } System . out . println ( isOK ? " YES " : " NO " ) ; } } }

import java . awt . Label ; import java . util . * ;   public class JavaApplication23 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ;   boolean check = true ; int n , m , index = 0 ; n = in . nextInt ( ) ; m = in . nextInt ( ) ;   String [ ] a = new String [ n ] ; int integer [ ] = new int [ n ] ;   while ( n != 0 ) { a [ index ] = in . next ( ) ; for ( int i = 0 ; i < a [ index ] . length ( ) - 1 ; i ++ ) { if ( a [ index ] . charAt ( i ) != a [ index ] . charAt ( i + 1 ) ) { check = false ; break ; } } index ++ ; n -- ; } if ( check ) { ConvertStringToInteger ( a , integer ) ; for ( int i = 1 ; i < integer . length - 1 ; i ++ ) { if ( ! ( integer [ i - 1 ] != integer [ i ] && integer [ i ] != integer [ i + 1 ] ) ) { check = false ; break ; } }   }   if ( check ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } }   public static void ConvertStringToInteger ( String [ ] a , int [ ] num ) { for ( int i = 0 ; i < a . length ; i ++ ) { for ( int j = 0 ; j < a [ i ] . length ( ) ; j ++ ) { num [ i ] += ( int ) a [ i ] . charAt ( j ) ; } } } }

''' Jana ▁ Goodman6 16A ▁ Flag n ▁ x ▁ m ▁ squares ▁ ( 1 . . 100)10 ▁ colors horizontal ▁ rows ▁ all ▁ same ▁ coloradjacent ▁ rows ▁ different ▁ colors   ''' SPACE = ' ▁ '   def all_same ( s ) : return s . count ( s [ 0 ] ) == len ( s )   def answer ( stripes , height , width ) : prev = ' x ' for s in stripes : if s [ 0 ] == prev or not all_same ( s ) : return ' NO ' prev = s [ 0 ] return ' YES '   if __name__ == ' _ _ main _ _ ' : rows , cols = map ( int , input ( ) . split ( SPACE ) ) stripes = [ ] for _ in range ( 0 , rows ) : stripes . append ( input ( ) . strip ( ) )   print ( answer ( stripes , rows , cols ) ) NEW_LINE

n , m = [ int ( j ) for j in input ( ) . split ( ) ] output = " YES " prev = str ( input ( ) ) if prev . count ( prev [ 0 ] ) != m : output = " NO " for j in range ( n - 1 ) : s = str ( input ( ) ) if s . count ( s [ 0 ] ) != m or s [ 0 ] == prev [ 0 ] : output = " NO " prev = sprint ( output ) NEW_LINE

n , m = map ( int , input ( ) . split ( ) ) li = [ ] for i in range ( n ) : li . append ( list ( map ( int , input ( ) ) ) )   if li [ 0 ] . count ( li [ 0 ] [ 0 ] ) != m : print ( ' NO ' ) else : for row in range ( 1 , len ( li ) ) :   if li [ row ] . count ( li [ row ] [ 0 ] ) != m : print ( ' NO ' ) break if li [ row - 1 ] == li [ row ] : print ( ' NO ' ) break else : print ( ' YES ' ) NEW_LINE

''' n , ▁ m ▁ = ▁ [ int ( item ) ▁ for ▁ item ▁ in ▁ input ( ) . split ( ' ▁ ' ) ] ans ▁ = ▁ ' YES ' cont ▁ = ▁ [ ]   def ▁ check ( s ) : ▁ ▁ ▁ ▁ for ▁ i ▁ in ▁ range ( len ( s ) ) : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ if ▁ s [ 0 ] ▁ ! = ▁ s [ i ] : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ return ▁ False ▁ ▁ ▁ ▁ return ▁ True  for ▁ i ▁ in ▁ range ( n ) : ▁ ▁ ▁ ▁ cont . append ( input ( ) ) ▁ ▁ ▁ ▁ if ▁ not ▁ check ( cont [ i ] ) : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ans ▁ = ▁ ' NO ' ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ break if ▁ ans ▁ ! = ▁ ' NO ' : ▁ ▁ ▁ ▁ for ▁ j ▁ in ▁ range ( n ▁ - ▁ 1 ) : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ s1 ▁ = ▁ cont [ j ] ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ s2 ▁ = ▁ cont [ j ▁ + ▁ 1 ] ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ if ▁ s1[0:1 ] ▁ = = ▁ s2[0:1 ] : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ans ▁ = ▁ ' NO ' ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ break print ( ans ) ''' n , m = [ int ( item ) for item in input ( ) . split ( ' ▁ ' ) ] prev , ans = ' ' , ' YES ' for i in range ( n ) : current = input ( ) if current == prev or current . count ( current [ 0 ] ) != m : ans = ' NO ' break prev = current   print ( ans ) NEW_LINE

def all_same ( s ) : return len ( set ( s ) ) == 1     def solve ( flag ) :   for row in flag : if not all_same ( row ) : return " NO " for i in range ( len ( flag ) - 2 ) : if flag [ i ] == flag [ i + 1 ] : return " NO " return " YES "   rows , cols = map ( int , input ( ) . split ( ) ) flag = [ ] for row in range ( rows ) : row = input ( ) flag . append ( row )     print ( solve ( flag ) ) NEW_LINE


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 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 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 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 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 ; } } }

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 ; }   } }

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 . 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 ) ; } }

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 ) ; } }

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 . 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 ) ;   } }

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 ) ; } }

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 . * ;   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 ) {

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 ;

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 . 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 {

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

""" 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 . 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 ( ) ; } } }

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 ( " " ) ; } } }

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 . 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 {

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 ) ; } }

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 . util . * ; public class BuggySorting {   public static void main ( String [ ] args ) {

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 + " ▁ " ) ; } }   } }

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 . 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 " ) ; } } }   }

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 ;

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 . * ; 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 ( ) ;

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 ( ) ; } }

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 . 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 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 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 . 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 ( ) ; } } }

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 ) ; } } } }

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 . 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 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 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 Main { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ;

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 " ) ; } } }

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 . 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 ) ;

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 {

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 . 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 ;

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 ; } }

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