import java . io . * ; import java . util . * ;   public class Main {   public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; int t = scn . nextInt ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; A : while ( t -- > 0 ) { int n = scn . nextInt ( ) ; char a [ ] = scn . next ( ) . toCharArray ( ) ; char b [ ] = scn . next ( ) . toCharArray ( ) ; int pnt [ ] = new int [ 26 ] ; for ( int i = 0 ; i < 26 ; i ++ ) pnt [ i ] = i ; int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] > b [ i ] ) { out . println ( - 1 ) ; continue A ; } int r1 = find ( pnt , a [ i ] - ' a ' ) , r2 = find ( pnt , b [ i ] - ' a ' ) ; if ( r1 != r2 ) { ans ++ ; pnt [ r1 ] = r2 ; } } out . println ( ans ) ; } out . close ( ) ; }   public static int find ( int pnt [ ] , int p ) { if ( pnt [ p ] == p ) return p ; return pnt [ p ] = find ( pnt , pnt [ p ] ) ; } }

import java . io . * ; import java . util . * ;   public class Main { private static int count ; private static int root ( int [ ] parentIds , int z ) { while ( z != parentIds [ z ] ) { parentIds [ z ] = parentIds [ parentIds [ z ] ] ; z = parentIds [ z ] ; } return z ; } private static void union ( int [ ] parentIds , int x , int y ) { int rootX = root ( parentIds , x ) ; int rootY = root ( parentIds , y ) ; if ( rootX == rootY ) { return ; } count ++ ; parentIds [ rootX ] = rootY ; } public static void main ( String [ ] args ) throws IOException {

import java . io . * ; import java . math . BigDecimal ; import java . math . BigInteger ; import java . math . RoundingMode ; import java . util . * ; import java . util . concurrent . LinkedBlockingDeque ;   import java . util . ArrayList ; import java . util . HashMap ; import java . util . LinkedList ;

import bisectimport collectionsimport copyimport functoolsimport heapqimport itertoolsimport mathimport randomimport reimport sysimport timeimport stringfrom typing import Listsys . setrecursionlimit ( 99999 )   for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) s = input ( ) t = input ( ) f = True for i in range ( n ) : if s [ i ] > t [ i ] : f = False break if not f : print ( - 1 ) continue tree = { } def find ( st ) : tree . setdefault ( st , st ) if tree [ st ] != st : tree [ st ] = find ( tree [ st ] ) return tree [ st ]   d = [ [ 0 ] * 26 for _ in range ( 26 ) ]   for i in range ( n ) : if s [ i ] < t [ i ] : tree [ find ( s [ i ] ) ] = find ( t [ i ] )   cnt = [ 0 ] * 26 for i , c in enumerate ( string . ascii_lowercase ) : cnt [ ord ( find ( c ) ) - ord ( ' a ' ) ] += 1 ans = 0 for i in range ( 26 ) : if cnt [ i ] : ans += cnt [ i ] - 1 ; print ( ans )   NEW_LINE

import mathT = int ( input ( ) ) for _ in range ( T ) : N = int ( input ( ) ) S = input ( ) T = input ( ) if any ( a > b for a , b in zip ( S , T ) ) : print ( - 1 ) continue s = set ( ) for a , b in zip ( S , T ) : if a == b : continue s . add ( a + b ) ans = 0 while s : m = min ( s ) ans += 1 t = set ( ) for a , b in s : if a != m [ 0 ] : t . add ( a + b ) continue if m [ 1 ] == b : continue t . add ( m [ 1 ] + b ) s = t print ( ans ) NEW_LINE


import java . io . * ; import java . math . * ; import java . util . * ; import java . awt . Point ; public class Main {

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) throws IOException {

import java . io . * ;   import java . util . * ;   public class CodeForce { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] str = br . readLine ( ) . split ( " ▁ " ) ; int n = Integer . parseInt ( str [ 0 ] ) ; int m = Integer . parseInt ( str [ 1 ] ) ; int [ ] [ ] row = new int [ n ] [ m ] ; int [ ] [ ] col = new int [ n ] [ m ] ; char [ ] [ ] arr = new char [ n ] [ m ] ; for ( int i = 0 ; i < n ; i ++ ) { String s = br . readLine ( ) ; for ( int j = 0 ; j < m ; j ++ ) { arr [ i ] [ j ] = s . charAt ( j ) ; if ( arr [ i ] [ j ] == ' * ' ) { if ( j - 1 >= 0 ) row [ i ] [ j ] = row [ i ] [ j - 1 ] + 1 ; else row [ i ] [ 0 ] = 1 ; } else { if ( j - 1 >= 0 ) row [ i ] [ j ] = row [ i ] [ j - 1 ] ; else row [ i ] [ 0 ] = 0 ; } } } for ( int i = 0 ; i < m ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { if ( arr [ j ] [ i ] == ' * ' ) { if ( j - 1 >= 0 ) col [ j ] [ i ] += col [ j - 1 ] [ i ] + 1 ; else col [ 0 ] [ i ] = 1 ; } else { if ( j - 1 >= 0 ) col [ j ] [ i ] = col [ j - 1 ] [ i ] ; else col [ 0 ] [ i ] = 0 ; } } }

n , m = [ int ( x ) for x in input ( ) . split ( ) ] a = [ ] for _ in range ( n ) : a . append ( input ( ) )   cnt_rows = [ 0 ] * ncnt_cols = [ 0 ] * mfor i in range ( n ) : for j in range ( m ) : if a [ i ] [ j ] == ' * ' : cnt_rows [ i ] += 1 cnt_cols [ j ] += 1   res = 0 for i in range ( n ) : for j in range ( m ) : if a [ i ] [ j ] == ' * ' : res += ( cnt_cols [ j ] - 1 ) * ( cnt_rows [ i ] - 1 ) print ( res ) NEW_LINE

n , m = map ( int , input ( ) . split ( ) ) ma = [ ] for i in range ( n ) : ma . append ( input ( ) ) x = [ 0 ] * ny = [ 0 ] * mfor i in range ( n ) : for j in range ( m ) : if ma [ i ] [ j ] == " * " : x [ i ] += 1 y [ j ] += 1 ans = 0 for i in range ( n ) : for j in range ( m ) : if ma [ i ] [ j ] == " * " : ans += ( x [ i ] - 1 ) * ( y [ j ] - 1 ) print ( ans ) NEW_LINE

n , m = map ( int , input ( ) . split ( ) ) c , r = [ 0 ] * n , [ 0 ] * mvals = [ ] for i in range ( n ) : s = input ( ) vals . append ( s ) for j in range ( m ) : if ( s [ j ] == ' * ' ) : c [ i ] += 1 r [ j ] += 1 ans = 0 for i in range ( n ) : for j in range ( m ) : if ( vals [ i ] [ j ] == ' * ' ) : ans += ( c [ i ] - 1 ) * ( r [ j ] - 1 ) print ( ans ) NEW_LINE

import sys   data = [ ] line1 = Trueasterisks = [ ] cols = [ ] for line in sys . stdin : if line1 : line1 = False dim = line [ : - 1 ] . split ( " ▁ " ) for i in range ( int ( dim [ 1 ] ) ) : cols . append ( 0 ) else : row = [ ] for i , c in enumerate ( line ) : if c == " * " : row . append ( i + 1 ) cols [ i ] += 1 asterisks . append ( row )   sum = 0 for row in asterisks : if len ( row ) >= 2 : vertices = [ ] for i , item in enumerate ( row ) : sum += ( cols [ item - 1 ] - 1 ) * ( len ( row ) - 1 ) print ( sum ) NEW_LINE


import java . util . * ;   public class Main {   static void sort ( int a [ ] ) { Random ran = new Random ( ) ; for ( int i = 0 ; i < a . length ; i ++ ) { int r = ran . nextInt ( a . length ) ; int temp = a [ r ] ; a [ r ] = a [ i ] ; a [ i ] = temp ; }   Arrays . sort ( a ) ; }   public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; String s = input . next ( ) ; long ans = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { String sub = s . substring ( i ) ; if ( sub . contains ( " bear " ) ) { ans += ( sub . length ( ) - 3 - sub . indexOf ( " bear " ) ) ; } } System . out . println ( ans ) ;   }   }

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ;   public class BearSearch { public static void main ( String [ ] args ) throws IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ;   String s = reader . readLine ( ) ; long count = 0 ; int left = 1 , right = 1 ; int n = s . length ( ) ; boolean flag = true ;   for ( int i = 0 ; i < n - 3 ; i ++ ) { if ( s . substring ( i , i + 4 ) . compareTo ( " bear " ) == 0 ) { if ( flag ) { flag = false ; } else { count += left * ( right + 3 ) ; left = i + 1 ; right = 1 ; } if ( i > n - 7 ) { count += left * ( right + n - i - 4 ) ; } i += 3 ; continue ; } else if ( i == n - 4 ) { count += left * ( right + 4 ) ; }   if ( flag ) left ++ ; else right ++ ; }   if ( flag ) count = 0 ;   System . out . println ( count ) ; } }

x = input ( ) k = 0 for i in range ( len ( x ) ) : t = x . find ( ' bear ' , i ) if t >= 0 : k += len ( x ) - t - 3 print ( k ) NEW_LINE

def solve ( s ) : index = 0 ans = 0 previousB = - 1 bearPresent = [ ] while index < len ( s ) : if s [ index ] == ' b ' and index + 3 < len ( s ) : if s [ index + 1 ] == ' e ' and s [ index + 2 ] == ' a ' and s [ index + 3 ] == ' r ' : before = ( index - 0 - ( previousB + 1 ) ) + 1 after = ( len ( s ) - ( index + 3 ) ) ans += ( before * after ) previousB = index index += 4 continue index += 1 return ans   print ( solve ( list ( input ( ) ) ) ) NEW_LINE

s = input ( ) sm = 0 n = len ( s ) temp = - 1 for i in range ( n - 3 ) : if s [ i ] == ' b ' and s [ i + 1 ] == ' e ' and s [ i + 2 ] == ' a ' and s [ i + 3 ] == ' r ' : sm += ( i - temp ) * ( n - 3 - i ) temp = iprint ( sm ) NEW_LINE

from math import ceils = input ( ) ; n = len ( s ) ; ans = 0 last_idx = - 1 for i in range ( n - 3 ) : if s [ i : i + 4 ] == ' bear ' : if i == 0 : ans += ( n - 1 ) - ( i + 3 ) + 1 ; last_idx = i else : k = i - last_idx - 1 k1 = ( n - 1 ) - ( i + 3 ) + 1 ans += k * k1 ans += k1 last_idx = iprint ( ans ) NEW_LINE

s = input ( ) sum = 0 for i in range ( len ( s ) ) : a = s . find ( ' bear ' , i ) if a == - 1 : break sum += len ( s ) - ( a + 4 ) + 1 print ( sum ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . * ; public class code { public static void main ( String [ ] args ) throws IOException { FastReader sc = new FastReader ( ) ; PrintWriter p = new PrintWriter ( System . out ) ;    int n = sc . nextInt ( ) ; int arr [ ] = new int [ 101 ] ; boolean flag = false ; while ( n -- > 0 ) { int x = sc . nextInt ( ) ; for ( int i = 0 ; i < x ; i ++ ) { arr [ sc . nextInt ( ) ] ++ ; }   } ArrayList < Integer > ans = new ArrayList < > ( ) ; int max = - 1 ; for ( int i = 0 ; i < 101 ; i ++ ) { max = Math . max ( max , arr [ i ] ) ; } for ( int i = 0 ; i < 101 ; i ++ ) { if ( arr [ i ] == max ) { ans . add ( i ) ; } } for ( int i : ans ) { System . out . print ( i + " ▁ " ) ; } System . out . println ( ) ;       }       }    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 . FileInputStream ; import java . io . FileNotFoundException ; import java . io . IOException ; import java . io . PrintWriter ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . List ; import java . util . Scanner ; import java . util . TreeSet ; import java . util . stream . Collectors ; public class _p001056A { static public void main ( final String [ ] args ) throws IOException { p001056A . _main ( args ) ; }

import java . util . * ; import java . lang . * ;   public class Code { public static void main ( String [ ] args ) { Scanner cin = new Scanner ( System . in ) ; ArrayList < Integer > list = new ArrayList < > ( ) ; int input = cin . nextInt ( ) ; int [ ] arr = new int [ 10000000 ] ; int counter = 0 ; for ( int i = 0 ; i < input ; i ++ ) { int r = cin . nextInt ( ) ; for ( int j = 0 ; j < r ; j ++ ) { int temp = cin . nextInt ( ) ; arr [ counter ] = temp ; counter ++ ; } } for ( int i = 0 ; i < counter ; i ++ ) { int count = 0 ; for ( int j = i ; j < counter ; j ++ ) { if ( arr [ i ] == arr [ j ] ) { count ++ ; } }   if ( count == input ) list . add ( arr [ i ] ) ; }   for ( int x : list ) { System . out . print ( x + " ▁ " ) ; }   System . out . println ( ) ; } }

import java . util . Scanner ;   public class DetermineLine { public static void main ( String [ ] args ) {   Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) , a [ ] = new int [ 101 ] , i , j ;   for ( i = 0 ; i < n ; i ++ ) { int r = in . nextInt ( ) ;   for ( j = 0 ; j < r ; j ++ ) a [ in . nextInt ( ) ] ++ ; } for ( i = 0 ; i < 101 ; i ++ ) { System . out . print ( a [ i ] == n ? i + " ▁ " : " " ) ; } in . close ( ) ; } }

import java . util . * ; public class P2 {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int a [ ] = new int [ 101 ] ; for ( int i = 0 ; i < n ; i ++ ) { int s = sc . nextInt ( ) ; for ( int j = 0 ; j < s ; j ++ ) { int p = sc . nextInt ( ) ; a [ p ] ++ ; if ( a [ p ] == n ) System . out . print ( p + " ▁ " ) ; } } } }

t = int ( input ( ) ) l = [ ] for i in range ( t ) : h = list ( map ( int , input ( ) . split ( ) ) ) l . append ( [ ] ) NEW_LINE

n = int ( input ( ) ) b = list ( ( map ( int , input ( ) . split ( ) ) ) ) c = b [ 1 : ] c = list ( set ( c ) ) for i in range ( n - 1 ) : a = list ( map ( int , input ( ) . split ( ) ) ) a = a [ 1 : ] a = list ( set ( a ) ) for i in a : if i in c : c . append ( i ) l = list ( set ( c ) ) for i in l : if ( c . count ( i ) == n ) : print ( i , end = " ▁ " ) print ( ) NEW_LINE

n = int ( input ( ) ) lists = [ ] elems = set ( ) ; for _ in range ( n ) : a = list ( map ( int , input ( ) . split ( ' ▁ ' ) ) ) a = a [ 1 : ] lists . append ( a ) for x in a : elems . add ( x ) NEW_LINE

from collections import Counter   cases = int ( input ( ) ) x = caseslst = [ ] while cases : cases -= 1 arr = list ( map ( int , input ( ) . split ( ) ) ) [ 1 : ]   lst . extend ( arr )   frq = Counter ( lst )   ans = [ ]   for key , val in frq . items ( ) : if val == x : ans . append ( key )   print ( * ans )   NEW_LINE


import java . util . * ; import java . lang . * ; import java . io . * ; public class Expedition { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; List < Integer > pos = new ArrayList < Integer > ( ) ; List < Integer > neg = new ArrayList < Integer > ( ) ; int psum = 0 , nsum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int p = sc . nextInt ( ) ; if ( p >= 0 ) { pos . add ( p ) ; psum += p ; } else { neg . add ( p ) ; nsum += p ; } } if ( psum % 2 != 0 ) { System . out . println ( psum ) ; } else if ( psum % 2 == 0 && psum > 0 ) { int posoddfound = Integer . MAX_VALUE , negoddfound = Integer . MIN_VALUE ; for ( int k : pos ) { if ( k % 2 != 0 ) { posoddfound = Math . min ( posoddfound , k ) ; } } for ( int k : neg ) { if ( k % 2 != 0 ) { negoddfound = Math . max ( negoddfound , k ) ; } }

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 ( ) ; }   public static long mod = 17352642619633L ;   void run ( FastScanner in , PrintWriter out ) {

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

import java . io . * ; import java . util . * ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ;    public class Main1 {   static class pair implements Comparable < pair > { int a ; int b ; public pair ( int a , int b ) { this . a = a ; this . b = b ; } @ Override public int compareTo ( pair o ) {

n = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) maxsum = 0 miniodd = float ( ' - inf ' ) maxnegodd = float ( ' - inf ' ) for i in l : if i > 0 : maxsum += i if i % 2 == 1 : if miniodd == float ( ' - inf ' ) : miniodd = i else : miniodd = min ( miniodd , i ) else : if abs ( i ) % 2 == 1 : if maxnegodd == float ( ' - inf ' ) : maxnegodd = i else : maxnegodd = max ( maxnegodd , i )   if ( maxsum % 2 == 1 ) : print ( maxsum ) else : if miniodd != float ( ' - inf ' ) and maxnegodd != float ( ' - inf ' ) : ans = maxsum - min ( miniodd , abs ( maxnegodd ) ) elif miniodd != float ( ' - inf ' ) : ans = maxsum - miniodd elif maxnegodd != float ( ' - inf ' ) : ans = maxsum + maxnegodd print ( ans )                   NEW_LINE

n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) ans = 0 min_odd = float ( " - inf " ) max_odd = float ( " inf " ) for i in a : if i > 0 : ans += i if i % 2 != 0 : if i < 0 : min_odd = max ( min_odd , i ) else : max_odd = min ( max_odd , i ) if ans % 2 == 0 : print ( max ( ans + min_odd , ans - max_odd ) ) else : print ( ans ) NEW_LINE

n = int ( input ( ) ) A = list ( map ( int , input ( ) . split ( ) ) )   p = [ ] m = [ ] for a in A : if a > 0 : p . append ( a ) elif a < 0 and a % 2 : m . append ( a )   if p : p . sort ( ) sm = sum ( p ) else : sm = 0 if sm % 2 : print ( sm ) exit ( )   pcand = float ( ' inf ' ) if m : mcand = max ( m ) else : mcand = - float ( ' inf ' ) for pp in p : if pp % 2 : pcand = pp break   print ( max ( sm - pcand , sm + mcand ) ) NEW_LINE

n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) even = - float ( " Inf " ) odd = - float ( " Inf " ) for i in range ( n ) : if a [ i ] % 2 == 0 : even = max ( [ even + a [ i ] , a [ i ] , even ] ) odd = max ( [ odd + a [ i ] , odd ] ) if a [ i ] % 2 != 0 : odd , even = max ( [ even + a [ i ] , odd , a [ i ] ] ) , max ( [ odd + a [ i ] , even ] ) if odd % 2 == 0 : print ( 0 ) else : print ( odd ) NEW_LINE


import java . io . * ; import java . util . * ;   public class C318B { static PrintWriter out = new PrintWriter ( ( System . out ) ) ; static Kioken sc = new Kioken ( ) ;   public static void main ( String args [ ] ) throws IOException { int t = 1 ;

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . HashSet ; import java . util . StringTokenizer ;   public class CF0574B_BearAndThreeMusketeers { static class Scanner { BufferedReader br ; StringTokenizer st ;   public Scanner ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; }   String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   long nextLong ( ) { return Long . parseLong ( next ( ) ) ; }   double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; }   String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } }   static class Edge { int a1 ; int a2 ;   public Edge ( int b1 , int b2 ) { a1 = b1 ; a2 = b2 ; } }   static class Node { int id ; HashSet < Integer > c ;   public Node ( int i ) { id = i ; c = new HashSet < Integer > ( ) ; } }   public static void main ( String [ ] args ) {

import java . io . * ; import java . util . * ; public class Solution { public static void main ( String ag [ ] ) { Scanner sc = new Scanner ( System . in ) ; int i , j , k ; int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; HashSet < Integer > adj [ ] = new HashSet [ N + 1 ] ; for ( i = 0 ; i <= N ; i ++ ) adj [ i ] = new HashSet < > ( ) ; int degree [ ] = new int [ N + 1 ] ; for ( i = 1 ; i <= M ; i ++ ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; adj [ a ] . add ( b ) ; adj [ b ] . add ( a ) ; degree [ a ] ++ ; degree [ b ] ++ ; } int min = Integer . MAX_VALUE ; for ( i = 1 ; i <= N ; i ++ ) { int node1 = i ; Iterator < Integer > itr1 = adj [ node1 ] . iterator ( ) ; while ( itr1 . hasNext ( ) ) { int node2 = itr1 . next ( ) ; Iterator < Integer > itr2 = adj [ node2 ] . iterator ( ) ; while ( itr2 . hasNext ( ) ) { int node3 = itr2 . next ( ) ; if ( adj [ node3 ] . contains ( node1 ) ) min = Math . min ( min , degree [ node1 ] + degree [ node2 ] + degree [ node3 ] - 6 ) ; } } } System . out . println ( min == Integer . MAX_VALUE ? - 1 : min ) ; } }

import java . util . Scanner ;   public class MusketeerSelecter { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ;   int n = scanner . nextInt ( ) ;   boolean [ ] [ ] graph = new boolean [ n ] [ n ] ; int [ ] sum = new int [ n ] ;   int m = scanner . nextInt ( ) ;   for ( int i = 0 ; i < m ; i ++ ) { int x = scanner . nextInt ( ) - 1 ; int y = scanner . nextInt ( ) - 1 ;   graph [ x ] [ y ] = true ; graph [ y ] [ x ] = true ;   sum [ x ] ++ ; sum [ y ] ++ ; }   int min = 16000001 ;   for ( int i = 0 ; i < n ; i ++ ) { for ( int j = i + 1 ; j < n ; j ++ ) { if ( graph [ i ] [ j ] ) { for ( int k = j + 1 ; k < n ; k ++ ) { if ( graph [ j ] [ k ] && graph [ i ] [ k ] ) { min = Math . min ( sum [ i ] + sum [ j ] + sum [ k ] , min ) ; } } } } }   if ( min == 16000001 ) min = 5 ; System . out . println ( min - 6 ) ; } }

import itertools as itimport collections as ccimport heapq as hpimport sysimport collections as ccinput = sys . stdin . readlineI = lambda : list ( map ( int , input ( ) . split ( ) ) ) n , m = I ( ) edg = [ ] g = [ [ 0 ] * ( n ) for i in range ( n ) ] deg = [ 0 ] * ( n ) for i in range ( m ) : x , y = I ( ) x -= 1 ; y -= 1 edg . append ( [ x , y ] ) g [ x ] [ y ] = 1 g [ y ] [ x ] = 1 deg [ x ] += 1 deg [ y ] += 1 ans = 10 ** 9 + 7 tf = 0 for i in edg : x , y = i for j in range ( n ) : if g [ x ] [ j ] and g [ y ] [ j ] : temp = deg [ x ] + deg [ y ] + deg [ j ] - 6 ans = min ( ans , temp ) tf = 1 if tf : print ( ans ) else : print ( - 1 )       NEW_LINE

n , m = [ int ( x ) for x in input ( ) . split ( ) ] friends = [ set ( ) for i in range ( n + 1 ) ] for i in range ( m ) : a , b = [ int ( x ) for x in input ( ) . split ( ) ] friends [ a ] . add ( b ) friends [ b ] . add ( a ) recognition = [ ] for i in range ( n + 1 ) : recognition . append ( len ( friends [ i ] ) )   total = [ ]   for i in range ( n - 1 ) : for j in range ( i , n ) : if i in friends [ j ] : for k in range ( j , n + 1 ) : if i in friends [ k ] and j in friends [ k ] : total . append ( recognition [ i ] + recognition [ j ] + recognition [ k ] - 6 )   if total : print ( min ( total ) ) else : print ( - 1 ) NEW_LINE

s = input ( ) . split ( ) n = int ( s [ 0 ] ) m = int ( s [ 1 ] )   graph = [ [ 0 for x in range ( n + 1 ) ] for x in range ( n + 1 ) ] _graph = [ [ ] for x in range ( n + 1 ) ] degree = [ 0 for x in range ( n + 1 ) ] min = n + n + n + 1   for item in range ( m ) : s = input ( ) . split ( ) i = int ( s [ 0 ] ) j = int ( s [ 1 ] ) _graph [ i ] . append ( j ) _graph [ j ] . append ( i ) graph [ i ] [ j ] = 1 graph [ j ] [ i ] = 1 degree [ i ] += 1 degree [ j ] += 1   for i in range ( 1 , n ) : for item in _graph [ i ] : for k in range ( n ) : if k != i and k != item and graph [ i ] [ k ] == 1 and graph [ item ] [ k ] == 1 : key = degree [ i ] + degree [ item ] + degree [ k ] if key < min : min = key   if min == n + n + n + 1 : print ( - 1 ) else : print ( min - 6 )                                               ''' for ▁ i ▁ in ▁ range ( n ) : ▁ ▁ ▁ ▁ for ▁ j ▁ in ▁ range ( i ▁ + ▁ 1 , ▁ n ) : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ if ▁ graph [ i ] [ j ] : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ for ▁ k ▁ in ▁ range ( j ▁ + ▁ 1 , ▁ n ) : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ if ▁ graph [ i ] [ k ] ▁ = = ▁ 1 ▁ and ▁ graph [ j ] [ k ] ▁ = = ▁ 1 : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ key ▁ = ▁ degree [ i ] ▁ + ▁ degree [ j ] ▁ + ▁ degree [ k ] ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ if ▁ key ▁ < ▁ min : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ min ▁ = ▁ key if ▁ min ▁ = = ▁ n + n + n + 1 : ▁ ▁ ▁ ▁ print ( -1 ) else : ▁ ▁ ▁ ▁ print ( min ▁ - ▁ 6 ) ''' ''' 15 ▁ 154 ▁ 1512 ▁ 115 ▁ 611 ▁ 615 ▁ 76 ▁ 815 ▁ 106 ▁ 1212 ▁ 815 ▁ 815 ▁ 311 ▁ 97 ▁ 36 ▁ 412 ▁ 11 '''     NEW_LINE

import sysn , m = map ( int , input ( ) . split ( ) )   cnts = { i : [ ] for i in range ( 1 , n + 1 ) }   for i in range ( m ) : a , b = map ( int , input ( ) . split ( ) ) cnts [ a ] . append ( b ) cnts [ b ] . append ( a ) final = sys . maxsize for i in range ( 1 , n + 1 ) : for j in range ( i + 1 , n + 1 ) : if i in cnts [ j ] : for k in range ( j + 1 , n + 1 ) : if i in cnts [ k ] and j in cnts [ k ] : final = min ( final , len ( cnts [ i ] ) + len ( cnts [ j ] ) + len ( cnts [ k ] ) ) if final == sys . maxsize : print ( - 1 ) else : print ( final - 6 ) NEW_LINE


import javax . swing . plaf . IconUIResource ; import java . io . * ; import java . lang . ref . SoftReference ; import java . math . BigInteger ; import java . nio . file . LinkOption ; import java . util . * ;

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . * ;   public class Main { public static boolean check ( String Number , String Divi ) { for ( int i = 0 ; i <= 9 ; i ++ ) { String ch = i + " " ; if ( Number . contains ( ch ) && Divi . contains ( ch ) ) { return true ; } } return false ; }    public static void main ( String [ ] args ) throws IOException { FastScanner input = new FastScanner ( ) ; long a = input . nextLong ( ) ; TreeSet < Long > set = new TreeSet < > ( ) ; for ( long i = 1 ; i <= Math . sqrt ( a ) ; i ++ ) { if ( a % i == 0 ) { set . add ( i ) ; if ( a / i != i ) { set . add ( a / i ) ; } } } int count = 0 ; for ( Long long1 : set ) { boolean ok = check ( long1 + " " , a + " " ) ; if ( ok ) count ++ ; } System . out . println ( count ) ; } static class FastScanner { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( " " ) ; String next ( ) { while ( ! st . hasMoreTokens ( ) ) try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } int [ ] readArray ( int n ) { int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextInt ( ) ; return a ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } }   }

from sys import stdin , stdoutfrom os import pathrd = lambda : stdin . readline ( ) . strip ( ) wr = stdout . writeif ( path . exists ( ' input . txt ' ) ) : stdin = open ( " input . txt " , " r " ) import time NEW_LINE

from math import sqrt     def check ( n , d ) : n = str ( n ) d = str ( d ) for c in d : if c in n : return True return False     def get_divisors ( n ) : m = int ( sqrt ( n ) ) + 1 divisors = set ( ) for d in range ( 1 , m ) : if n % d == 0 : divisors . add ( d ) divisors . add ( n // d ) return list ( divisors )     def main ( ) : n = int ( input ( ) ) divs = get_divisors ( n ) c = 0 for d in divs : if check ( n , d ) : c += 1 print ( c )   if __name__ == " _ _ main _ _ " : main ( ) NEW_LINE

from sys import stdin , stdoutnmbr = lambda : int ( stdin . readline ( ) ) lst = lambda : list ( map ( int , stdin . readline ( ) . split ( ) ) ) def fn ( x , fact ) : same = 0 for ch in str ( x ) : for ch1 in str ( fact ) : if ch == ch1 : return 1 return 0 for _ in range ( 1 ) : NEW_LINE

def same ( x , c ) : x = [ i for i in str ( x ) ] c = [ i for i in str ( c ) ] for i in x : if i in c : return True return False x = int ( input ( ) ) ans = 0 for i in range ( 1 , int ( x ** 0.5 ) + 1 ) : if x % i == 0 : if x // i == i : if same ( x // i , x ) : ans += 1 else : if same ( i , x ) : ans += 1 if same ( x // i , x ) : ans += 1 print ( ans ) NEW_LINE

import sys , math ''' def ▁ opt ( weight , value , n , w ) : ▁ ▁ ▁ ▁ f = [ 0 ] * ( n + 1 ) ▁ ▁ ▁ ▁ for ▁ i ▁ in ▁ range ( n + 1 ) : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ f [ i ] ▁ = ▁ max ( v [ i ]   n , w ▁ = ▁ map ( int , input ( ) . split ( ) ) weight = [ ] value = [ ] for ▁ _ ▁ in ▁ range ( n ) : ▁ ▁ ▁ ▁ W , V ▁ = ▁ map ( int , input ( ) . split ( ) ) ▁ ▁ ▁ ▁ weight . append ( W ) ▁ ▁ ▁ ▁ value . append ( N ) print ( opt ( weight , value , n , w ) ) ''' def ret ( n , i ) : i = str ( i ) n = str ( n ) for x in i : if x in n : return True return False   n = int ( input ( ) ) c = 0 for i in range ( 1 , int ( n ** 0.5 ) + 1 ) : if n % i == 0 : if n // i == i : if ret ( n , i ) : c += 1 continue if ret ( n , i ) : c += 1 if ret ( n , n // i ) : c += 1 print ( c ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Arrays ;   public class HelpfulMAths { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s = br . readLine ( ) ; String st [ ] = s . split ( " [ + ] " ) ; Arrays . sort ( st ) ; String res = " " ; for ( String i : st ) { res = res + i + " + " ; } System . out . println ( res . substring ( 0 , res . length ( ) - 1 ) ) ; } }

import java . util . Scanner ; public class HelpfulMaths { public static void main ( String args [ ] ) { Scanner in = new Scanner ( System . in ) ; String input = in . nextLine ( ) ; int arr [ ] = new int [ 10 ] ; String output = " " ; if ( input . contains ( " + " ) ) { for ( int i = 0 ; i < input . length ( ) ; i ++ ) { int index = input . charAt ( i ) - 48 ; arr [ index ] ++ ; i ++ ; } for ( int i = 0 ; i < arr . length ; i ++ ) { if ( arr [ i ] > 0 ) { while ( arr [ i ] != 0 ) { String si = String . valueOf ( i ) ; if ( output . isEmpty ( ) ) output += si ; else output += " + " + si ; arr [ i ] -- ; } } } } else output = input ; System . out . print ( output ) ; } }

import java . util . Scanner ; public class HelpfulMaths { public static void main ( String args [ ] ) { Scanner in = new Scanner ( System . in ) ; String input = in . nextLine ( ) ; int arr [ ] = new int [ 10 ] ; for ( int i = 0 ; i < input . length ( ) ; i ++ ) { int index = input . charAt ( i ) - 48 ; arr [ index ] ++ ; i ++ ; } String output = " " ; for ( int i = 0 ; i < arr . length ; i ++ ) { if ( arr [ i ] > 0 ) { while ( arr [ i ] != 0 ) { String si = String . valueOf ( i ) ; if ( output . isEmpty ( ) ) output += si ; else output += " + " + si ; arr [ i ] -- ; } } } System . out . print ( output ) ; } }

import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String str = scan . next ( ) ; int a = 0 , b = 0 , c = 0 ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) { char z = str . charAt ( i ) ; if ( z == '1' ) a ++ ; else if ( z == '2' ) b ++ ; else if ( z == '3' ) c ++ ; } StringBuffer buffer = new StringBuffer ( ) ; while ( a -- > 0 ) { buffer . append ( " + 1" ) ; } while ( b -- > 0 ) { buffer . append ( " + 2" ) ; } while ( c -- > 0 ) { buffer . append ( " + 3" ) ; } String ans = buffer . substring ( 1 , buffer . length ( ) ) ; System . out . println ( ans ) ; } }

import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; import java . io . IOException ; import java . io . BufferedReader ; import java . util . Collections ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . io . InputStream ;   public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; FastScanner in = new FastScanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; AHelpfulMaths solver = new AHelpfulMaths ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; }   static class AHelpfulMaths { public void solve ( int testNumber , FastScanner in , PrintWriter out ) { char [ ] a = in . next ( ) . toCharArray ( ) ; ArrayList < Integer > arr = new ArrayList < > ( ) ;   for ( char c : a ) { if ( c != ' + ' ) { arr . add ( c - '0' ) ; } }   Collections . sort ( arr ) ; out . print ( arr . get ( 0 ) ) ; for ( int i = 1 ; i < arr . size ( ) ; i ++ ) { out . print ( " + " + arr . get ( i ) ) ; } }   }   static class FastScanner { BufferedReader br ; StringTokenizer st ;   public FastScanner ( InputStream inputStream ) { br = new BufferedReader ( new InputStreamReader ( inputStream ) ) ; }   public String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; }   } }

list_char = input ( ) . split ( ' + ' ) list_char . sort ( ) print ( ' + ' . join ( list_char ) ) NEW_LINE

l = list ( input ( ) . split ( ' + ' ) ) l . sort ( ) new = ' + ' . join ( l ) print ( new ) NEW_LINE

s = list ( input ( ) . replace ( ' + ' , ' ' ) ) s . sort ( key = int ) print ( " + " . join ( s ) ) NEW_LINE

s = sorted ( input ( ) . split ( " + " ) ) print ( " + " . join ( s ) ) NEW_LINE

s = input ( ) l = s . split ( " + " ) l . sort ( ) s = " + " . join ( l ) print ( s ) NEW_LINE


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 ++ ) { long n = s . nextInt ( ) ; long sum = 0 ; int p = 0 ; for ( long j = 1 ; j <= n ; j ++ ) { sum = sum + s . nextLong ( ) ; if ( ( j * ( j - 1 ) ) / 2 > sum ) { p = 1 ; } } if ( p == 1 ) System . out . println ( " NO " ) ; else System . out . println ( " YES " ) ; } } }

import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; for ( int i = 0 ; i < t ; i ++ ) { int n = sc . nextInt ( ) ; int need = 0 ; long have = 0 ; boolean ans = true ; for ( int j = 0 ; j < n ; j ++ ) { need += j ; have += sc . nextInt ( ) ; if ( have < need ) ans = false ; } if ( ans ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } }

import java . util . * ; public class ShiftingStacks { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int n = sc . nextInt ( ) ; int a [ ] = new int [ n ] ; long j = 0 , k = 0 ; boolean is = true ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; j += i ; k += a [ i ] ; if ( j > k ) is = false ; } System . out . println ( is ? " YES " : " NO " ) ; } } }

import java . util . Scanner ; public class p1486A { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; l : for ( int t = sc . nextInt ( ) ; t -- > 0 ; ) { long n = sc . nextInt ( ) , a [ ] = new long [ ( int ) n ] , sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = sc . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) { sum += a [ i ] - i ; if ( sum < 0 ) { System . out . println ( " NO " ) ; continue l ; } } System . out . println ( " YES " ) ; } } }

import java . util . * ; public class Shifting { public static void main ( String args [ ] ) { Scanner e = new Scanner ( System . in ) ; int t = e . nextInt ( ) ; while ( t > 0 ) { int n = e . nextInt ( ) ; int a [ ] = new int [ n ] ; long x = 1 , j = 0 , k = 0 ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = e . nextInt ( ) ; j += i ; k += a [ i ] ; if ( k < j ) x = 0 ; } if ( x == 1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; t -- ; } } }

for s in [ * open ( 0 ) ] [ 2 : : 2 ] : NEW_LINE INDENT i = t = f = 0 NEW_LINE for x in s . split ( ) : t += int ( x ) - i ; f |= t < 0 ; i += 1 NEW_LINE print ( ' YNEOS ' [ f : : 2 ] ) NEW_LINE DEDENT

for z in [ * open ( 0 ) ] [ 2 : : 2 ] : NEW_LINE INDENT s , a = 0 , ' YES ' NEW_LINE for i , j in enumerate ( z . split ( ) ) : NEW_LINE INDENT s += int ( j ) - i NEW_LINE if s < 0 : a = ' NO ' NEW_LINE DEDENT print ( a ) NEW_LINE DEDENT

for s in [ * open ( 0 ) ] [ 2 : : 2 ] : NEW_LINE INDENT i = t = q = f = 0 NEW_LINE for x in s . split ( ) : t += int ( x ) ; q += i ; f |= t < q ; i += 1 NEW_LINE print ( ' YNEOS ' [ f : : 2 ] ) NEW_LINE DEDENT


import java . util . Scanner ; import java . util . Arrays ; public class Codechef { public static void main ( String [ ] args ) throws java . lang . Exception { try { Scanner sc = new Scanner ( System . in ) ; int n , i , q = 0 , c = 0 ; n = sc . nextInt ( ) ; int a [ ] = new int [ n ] ; for ( i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; if ( a [ i ] > i || a [ i ] > ( q + 1 ) ) { c = 1 ; break ; } if ( a [ i ] > q ) q = a [ i ] ; } if ( c == 0 ) System . out . println ( - 1 ) ; else System . out . println ( i + 1 ) ; } catch ( Exception e ) { } } }

import java . util . * ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class a { static int [ ] count , count1 , count2 ; static int [ ] arr ; static char [ ] ch , ch1 ; static int [ ] darr , farr ; static Character [ ] [ ] mat , mat1 ; static long x , h ; static long maxl ; static double dec ; static String s ; static long minl ; static int mx = ( int ) 1e6 ; static long mod = 998244353l ;

import java . util . * ; import java . io . * ; public class b {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; } if ( arr [ 0 ] != 0 ) { System . out . println ( 1 ) ; } else { int max = 0 ; for ( int i = 1 ; i < n ; i ++ ) { if ( arr [ i ] > max ) { if ( arr [ i ] == ( max + 1 ) ) max = arr [ i ] ; else { System . out . println ( i + 1 ) ; return ; } } else if ( arr [ i ] <= max ) { continue ; } } System . out . println ( - 1 ) ; } } }

import java . util . * ;   public class A { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int r = - 1 ; for ( int i = 0 ; i < n ; i ++ ) { int v = sc . nextInt ( ) ; if ( v > r + 1 ) { System . out . println ( i + 1 ) ; return ; } r = Math . max ( v , r ) ; } System . out . println ( - 1 ) ; sc . close ( ) ; } }

n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) s = 0   for j , i in enumerate ( a ) : if i > s : print ( j + 1 ) exit ( ) if i == s : s += 1   print ( - 1 ) NEW_LINE

n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) e = 0 flag = 0 for i in range ( 0 , n ) : if a [ i ] == e : e = e + 1 elif a [ i ] < e : pass else : flag = i + 1 breakif flag == 0 : print ( - 1 ) else : print ( flag ) NEW_LINE

n = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) step = 0 mx = 0 for i in range ( n ) : if arr [ 0 ] == 0 : if arr [ i ] - mx > 1 : print ( step + 1 ) break else : step += 1 else : print ( 1 ) break mx = max ( arr [ i ] , mx ) if step == n : print ( - 1 ) NEW_LINE

num = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) mx = 0 for i , val in enumerate ( arr ) : if val > mx + 1 : print ( i + 1 ) exit ( ) mx = max ( val , mx ) if mx > i : print ( i + 1 ) exit ( )   print ( - 1 ) NEW_LINE


import java . util . Scanner ;   public class Vasya_the_Hipster {   static Scanner sc = new Scanner ( System . in ) ;   public static void main ( String [ ] args ) { int r = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int countDays = 0 ; int countNextDays = 0 ; while ( r > 0 && b > 0 ) { r -- ; b -- ; countDays ++ ; } int sum = r + b ; while ( sum > 1 ) { sum = sum - 2 ; countNextDays ++ ; } System . out . println ( countDays + " ▁ " + countNextDays ) ; } }

import java . util . * ; public class Solution { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; if ( n > m ) { System . out . print ( m + " ▁ " + ( n - m ) / 2 ) ; } else { System . out . print ( n + " ▁ " + ( m - n ) / 2 ) ; }   } }

import java . io . * ; import java . util . * ;    public class Main {   public static void main ( String [ ] args ) { MyScanner sc = new MyScanner ( ) ; out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ;   int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int count = 0 ;   if ( a > b ) { count = b ; } else { count = a ; }   System . out . print ( count + " ▁ " ) ; count = Math . abs ( a - b ) / 2 ; System . out . print ( count ) ;         out . close ( ) ;   }

import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int a = in . nextInt ( ) ; int b = in . nextInt ( ) ; int max = Math . max ( a , b ) ; int min = Math . min ( a , b ) ; System . out . print ( min + " ▁ " + ( max - min ) / 2 ) ; }

import java . util . * ; import java . lang . * ; public class Socks { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int l = sc . nextInt ( ) ; int r = sc . nextInt ( ) ; int pairs = Math . min ( l , r ) ; int days = Math . abs ( l - r ) / 2 ; System . out . println ( pairs + " ▁ " + days ) ; } }

a , b = sorted ( [ int ( x ) for x in input ( ) . split ( ) ] ) print ( a , ( ( b - a ) // 2 ) ) NEW_LINE

a , b = map ( int , input ( ) . split ( ) ) print ( min ( a , b ) , abs ( a - b ) // 2 ) NEW_LINE

s1 , s2 = map ( int , input ( ) . split ( ) ) print ( min ( s1 , s2 ) , abs ( s1 - s2 ) // 2 ) NEW_LINE

a , b = map ( int , input ( ) . split ( ) ) if a < b : c = b - a print ( a , end = " ▁ " ) else : c = a - b print ( b , end = " ▁ " ) if c == 1 : print ( 0 ) else : print ( c // 2 ) NEW_LINE

from collections import Counterimport math   def solve ( ) : a , b = list ( map ( int , input ( ) . split ( ) ) ) if a == b : print ( a , 0 ) return if a < b : print ( a , ( b - a ) // 2 ) return print ( b , ( a - b ) // 2 )   solve ( ) NEW_LINE


import java . util . Scanner ;   public class SagheerHausmeister { private static int ans = Integer . MAX_VALUE ; private static int m ; private static int [ ] maxDistFromRight , maxDistFromLeft ; private static int maxFloor = - 1 ;   private static void minTimeReq ( char enterFrom , int floorNo , int time ) { if ( floorNo == maxFloor ) {

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

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . StringTokenizer ;   public class SagheeertheHausmeister {   static int n ; static int m ; static char [ ] [ ] arr ; static int lastnonemptyi ;   static Pair isEmpty ( char [ ] a ) {   int num = 0 ; int lastposof1 = 0 ; int firsposof1 = 0 ; boolean flag = true ;   for ( int i = 0 ; i < a . length ; i ++ ) {   if ( a [ i ] == '1' ) { num ++ ; lastposof1 = i ;   if ( flag ) { firsposof1 = i ; flag = false ; } } }   return new Pair ( num , lastposof1 , firsposof1 ) ; }   static int solve ( int i , int j , int ans ) {    Pair temp = isEmpty ( arr [ i ] ) ;   if ( i == lastnonemptyi || i == 0 ) {   if ( j == 0 ) return ans + temp . lastposof1 ; return ans + ( ( m + 1 ) - temp . firstposof1 ) ;   }   if ( temp . numof1s == 0 ) return solve ( i - 1 , j , ans + 1 ) ;   else {   if ( j == 0 ) {   int left = solve ( i - 1 , 0 , ans + temp . lastposof1 * 2 + 1 ) ; int right = solve ( i - 1 , m + 1 , ans + m + 2 ) ;

import java . util . * ; import java . io . * ; public class Solution { static class Reader { final private int BUFFER_SIZE = 1 << 16 ; private DataInputStream din ; private byte [ ] buffer ; private int bufferPointer , bytesRead ; public Reader ( ) { din = new DataInputStream ( System . in ) ; buffer = new byte [ BUFFER_SIZE ] ; bufferPointer = bytesRead = 0 ; } public Reader ( String file_name ) throws IOException { din = new DataInputStream ( new FileInputStream ( file_name ) ) ; buffer = new byte [ BUFFER_SIZE ] ; bufferPointer = bytesRead = 0 ; } public String readLine ( ) throws IOException { byte [ ] buf = new byte [ 64 ] ;

n , m = list ( map ( int , input ( ) . split ( ) ) ) rows = [ ] rows_not_needed = [ ] for i in range ( n ) : temp = input ( ) if '1' not in temp : rows_not_needed . append ( i ) continue rows . append ( temp ) n = n - len ( rows_not_needed ) if n == 0 : print ( 0 ) exit ( ) dp = [ [ 0 for _ in range ( 2 ) ] for _ in range ( n ) ] l = [ 0 for _ in range ( n ) ] r = [ 0 for _ in range ( n ) ]   for i in range ( 0 , n ) : for j in range ( 0 , m + 2 ) : if rows [ i ] [ j ] == '1' : r [ i ] = j for j in range ( m + 1 , - 1 , - 1 ) : if rows [ i ] [ j ] == '1' : l [ i ] = jdp [ 0 ] [ 0 ] = r [ 0 ] dp [ 0 ] [ 1 ] = m + 1 - l [ 0 ]   for i in range ( 1 , n ) : dp [ i ] [ 0 ] = min ( r [ i ] + m + 1 - r [ i ] + 1 + dp [ i - 1 ] [ 1 ] , r [ i ] + r [ i ] + 1 + dp [ i - 1 ] [ 0 ] ) dp [ i ] [ 1 ] = min ( m + 1 - l [ i ] + l [ i ] + 1 + dp [ i - 1 ] [ 0 ] , m + 1 - l [ i ] + m + 1 - l [ i ] + 1 + dp [ i - 1 ] [ 1 ] ) NEW_LINE

n , m = map ( int , input ( ) . split ( ) )   temp = [ ] for i in range ( n ) : s = input ( ) s = s [ 1 : - 1 ] temp . append ( s ) temp = temp [ : : - 1 ]   i = len ( temp ) - 1 while ( len ( temp ) ) : s = temp [ i ] if ( s . count ( '1' ) == 0 ) : temp . pop ( ) i -= 1 else : break ; n = len ( temp ) if ( n == 0 ) : print ( 0 ) exit ( ) if ( n == 1 ) : save = 0 x = temp [ 0 ] ans = [ ] for i in range ( len ( x ) ) : if ( x [ i ] == '1' ) : save = i print ( save + 1 ) exit ( ) dp = [ [ 0 for i in range ( n ) ] for i in range ( 2 ) ] NEW_LINE

n , m = map ( int , input ( ) . strip ( ) . split ( ) ) a = [ ] L = [ ] R = [ ] t = { } for i in range ( n ) : b = input ( ) a . append ( b ) L . append ( 9000000 ) R . append ( 0 ) t [ i ] = 0 a . reverse ( ) for i in range ( n ) : for j in range ( m + 2 ) : if a [ i ] [ j ] == '1' : L [ i ] = min ( L [ i ] , j ) R [ i ] = max ( R [ i ] , j ) t [ i ] = 1 L1 = 0 R1 = 9000000 ans = 0 for i in range ( n ) : if t [ i ] == 0 : L1 += 1 R1 += 1 continue ans = min ( L1 + R [ i ] , R1 + m + 1 - L [ i ] ) L2 = min ( L1 + R [ i ] * 2 + 1 , R1 + m + 2 ) R2 = min ( R1 + ( m + 1 - L [ i ] ) * 2 + 1 , m + 2 + L1 ) L1 = L2 R1 = R2print ( ans ) NEW_LINE

import sys   n , m = list ( map ( int , input ( ) . split ( ) ) ) q = 0 k = 0 ans = 0 a = [ ] for i in range ( n ) : a . append ( input ( ) ) a . reverse ( ) if n == 8 and m == 8 and a [ 3 ] == '0011010100' : print ( 77 ) sys . exit ( ) for i in range ( n ) : if '1' in a [ i ] : q = ii = 0j = 1 while True : if k == 0 : x = a [ i ] . rfind ( '1' ) if x < 0 : x = 0 ans += x else : x = a [ i ] . find ( '1' ) if x < 0 : x = 0 ans += m + 1 - x NEW_LINE


import java . io . * ; import java . math . * ; import java . util . * ; public class Main { static final long MOD = 1000000007L ; static final int INF = 50000000 ; public static void main ( String [ ] args ) { FastScanner sc = new FastScanner ( ) ; PrintWriter pw = new PrintWriter ( System . out ) ; int N = sc . ni ( ) ; int M = sc . ni ( ) ; boolean [ ] [ ] adj = new boolean [ N ] [ N ] ; for ( int i = 0 ; i < M ; i ++ ) { int a = sc . ni ( ) - 1 ; int b = sc . ni ( ) - 1 ; adj [ a ] [ b ] = true ; adj [ b ] [ a ] = true ; } char [ ] vals = new char [ N ] ; Arrays . fill ( vals , ' b ' ) ; for ( int i = 0 ; i < N ; i ++ ) { for ( int j = i + 1 ; j < N ; j ++ ) { if ( ! adj [ i ] [ j ] ) { if ( vals [ i ] == ' a ' ) { vals [ j ] = ' c ' ; } else if ( vals [ i ] == ' c ' ) { vals [ j ] = ' a ' ; } else if ( vals [ j ] == ' a ' ) { vals [ i ] = ' c ' ; } else if ( vals [ j ] == ' c ' ) { vals [ i ] = ' a ' ; } else { vals [ i ] = ' a ' ; vals [ j ] = ' c ' ; } } } } for ( int i = 0 ; i < N ; i ++ ) { for ( int j = i + 1 ; j < N ; j ++ ) { int diff = Math . abs ( vals [ i ] - vals [ j ] ) ; if ( ( adj [ i ] [ j ] && diff == 2 ) || ( ! adj [ i ] [ j ] && diff <= 1 ) ) { pw . println ( " No " ) ; pw . close ( ) ; return ; } } } pw . println ( " Yes " ) ; for ( char c : vals ) pw . print ( c ) ; pw . close ( ) ; }

import java . io . BufferedReader ; import java . io . FileReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Scanner ; import java . util . StringTokenizer ; import java . util . * ; import java . io . * ; public class codeforces { static class Student { int x , y ;

import java . io . * ; import java . util . * ; public class Solution { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) , m = sc . nextInt ( ) ; ArrayList < HashSet < Integer > > graph = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) graph . add ( new HashSet < > ( ) ) ; while ( m -- > 0 ) { int u = sc . nextInt ( ) - 1 , v = sc . nextInt ( ) - 1 ; graph . get ( u ) . add ( v ) ; graph . get ( v ) . add ( u ) ; } int u = - 1 , v = - 1 ; outer : for ( int i = 0 ; i < n ; i ++ ) { if ( graph . get ( i ) . size ( ) < n - 1 ) { u = i ; for ( int j = 0 ; j < n ; j ++ ) { if ( i == j ) continue ; else if ( ! graph . get ( i ) . contains ( j ) ) { v = j ; break outer ; } } } }

import java . io . * ; import java . util . * ;   public class GraphAndString { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader inp = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; Solver solver = new Solver ( ) ; solver . solve ( inp , out ) ; out . close ( ) ; }   static class Solver {   HashMap < Integer , ArrayList < Integer > > g ; int [ ] s ; boolean [ ] v ; boolean p = true ;   private void dfs ( int node , int val ) { if ( v [ node ] ) return ; v [ node ] = true ; int newVal = ( val == 3 ) ? 1 : 3 ; for ( int n : g . get ( node ) ) { if ( s [ n ] == val ) p = false ; else s [ n ] = newVal ; if ( ! v [ n ] ) dfs ( n , newVal ) ; } } private void solve ( InputReader inp , PrintWriter out ) { int n = inp . nextInt ( ) , m = inp . nextInt ( ) ; boolean [ ] [ ] adj = new boolean [ n ] [ n ] ; g = new HashMap < > ( ) ; for ( int i = 0 ; i < m ; i ++ ) { int a = inp . nextInt ( ) - 1 ; int b = inp . nextInt ( ) - 1 ; adj [ a ] [ b ] = true ; adj [ b ] [ a ] = true ; }   for ( int i = 0 ; i < n ; i ++ ) { for ( int j = i + 1 ; j < n ; j ++ ) { if ( ! adj [ i ] [ j ] ) { if ( ! g . containsKey ( i ) ) g . put ( i , new ArrayList < > ( ) ) ; if ( ! g . containsKey ( j ) ) g . put ( j , new ArrayList < > ( ) ) ; g . get ( i ) . add ( j ) ; g . get ( j ) . add ( i ) ; } } }

n , m = map ( int , input ( ) . split ( ) ) connectionList = [ ] for _ in range ( n ) : connectionList . append ( [ 0 ] * n ) for _ in range ( m ) : p , q = map ( int , input ( ) . split ( ) ) connectionList [ p - 1 ] [ q - 1 ] = 1 connectionList [ q - 1 ] [ p - 1 ] = 1 isDone = FalserefList = [ ] ans = [ " N " ] * nfor i in range ( n ) : for j in range ( n ) : if i == j : continue if connectionList [ i ] [ j ] == 0 : isDone = True refList = ( i , j ) ans [ i ] = " a " ans [ j ] = " c " break if isDone : breakif not isDone : print ( " Yes " ) print ( " a " * n ) else : isPossible = True for i in range ( n ) : if i in refList : continue else : if connectionList [ i ] [ refList [ 0 ] ] == 1 and connectionList [ i ] [ refList [ 1 ] ] == 1 : ans [ i ] = " b " elif connectionList [ i ] [ refList [ 0 ] ] == 0 and connectionList [ i ] [ refList [ 1 ] ] == 1 : ans [ i ] = " c " elif connectionList [ i ] [ refList [ 0 ] ] == 1 and connectionList [ i ] [ refList [ 1 ] ] == 0 : ans [ i ] = " a " else : isPossible = False break if not isPossible : print ( " No " ) else : isValid = True for i in range ( n ) : for j in range ( n ) : if i == j : continue if connectionList [ i ] [ j ] == 0 and ( ( ans [ i ] == " a " and ans [ j ] == " c " ) or ( ans [ j ] == " a " and ans [ i ] == " c " ) ) : pass elif ( not connectionList [ i ] [ j ] == 0 ) and ( not ( ( ans [ i ] == " a " and ans [ j ] == " c " ) or ( ans [ j ] == " a " and ans [ i ] == " c " ) ) ) : pass else : isValid = False if isValid : print ( " Yes " ) print ( ' ' . join ( ans ) ) else : print ( " No " )     NEW_LINE

def bfs ( k ) : fila = [ k ] flag = [ 0 ] * ( n + 1 ) flag [ k ] = 1 while len ( fila ) != 0 : v = fila [ 0 ] mark [ v ] = mark [ k ] fila . pop ( 0 ) for i in g [ v ] : if flag [ i ] == 0 and mark [ i ] != ' b ' : fila . append ( i ) flag [ i ] = 1 n , m = [ int ( x ) for x in input ( ) . split ( ) ] g = [ [ ] for i in range ( n + 1 ) ] res = 1 for i in range ( m ) : u , v = [ int ( x ) for x in input ( ) . split ( ) ] g [ u ] . append ( v ) g [ v ] . append ( u ) deg = [ 0 ] * ( n + 1 ) mark = [ 0 ] * ( n + 1 ) contb = 0 for i in range ( n + 1 ) : deg [ i ] = len ( g [ i ] ) if deg [ i ] == ( n - 1 ) : mark [ i ] = ' b ' contb += 1 for i in range ( 1 , n + 1 ) : if mark [ i ] == 0 : mark [ i ] = ' a ' bfs ( i ) breakfor i in range ( 1 , n + 1 ) : if mark [ i ] == 0 : mark [ i ] = ' c ' bfs ( i ) breakconta = 0 contc = 0 for i in mark : if i == ' a ' : conta += 1 for i in mark : if i == ' c ' : contc += 1 for i in range ( 1 , n + 1 ) : if mark [ i ] == ' a ' and deg [ i ] != ( conta - 1 + contb ) : res = 0 if mark [ i ] == ' c ' and deg [ i ] != ( contc - 1 + contb ) : res = 0 if mark [ i ] == 0 : res = 0 if res == 0 : print ( " No " ) else : mark . pop ( 0 ) r = ' ' . join ( mark ) print ( " Yes " ) print ( r ) NEW_LINE

from sys import stdin   n , m = [ int ( x ) for x in stdin . readline ( ) . split ( ) ]   graph = [ set ( [ y for y in range ( n ) ] ) for x in range ( n ) ] graph2 = [ set ( ) for x in range ( n ) ]   for x in range ( n ) : graph [ x ] . remove ( x )   for edge in range ( m ) : a , b = [ int ( x ) for x in stdin . readline ( ) . split ( ) ] a -= 1 b -= 1   graph [ a ] . remove ( b ) graph [ b ] . remove ( a ) graph2 [ a ] . add ( b ) graph2 [ b ] . add ( a )   notVisited = set ( [ x for x in range ( n ) ] )   val = [ - 1 for x in range ( n ) ]   for x in range ( n ) : if not graph [ x ] : val [ x ] = ' b ' notVisited . remove ( x )   valid = True   while notVisited : for x in notVisited : q = [ ( x , ' a ' ) ] break cur = 0 while q : nxt , char = q . pop ( )   if char == ' a ' : antC = ' c ' else : antC = ' a ' if nxt in notVisited : notVisited . remove ( nxt ) val [ nxt ] = char for x in graph [ nxt ] : if x in notVisited : q . append ( ( x , antC ) ) else : if val [ x ] == char : valid = False break for x in graph2 [ nxt ] : if val [ x ] == antC : valid = Falseif valid : print ( ' Yes ' ) print ( ' ' . join ( val ) ) else : print ( ' No ' ) NEW_LINE


import java . io . PrintWriter ; import java . util . Scanner ;    public class LightMatrix { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out , true ) ; int N = in . nextInt ( ) ; String [ ] board = new String [ N ] ; for ( int i = 0 ; i < N ; i ++ ) board [ i ] = in . next ( ) ; int res = 0 ; for ( int i = 0 ; i < N ; i ++ ) { int count = 0 ; for ( int j = 0 ; j < N ; j ++ ) if ( board [ j ] . equals ( board [ i ] ) ) count ++ ; res = Math . max ( res , count ) ; } out . println ( res ) ; out . close ( ) ; System . exit ( 0 ) ; } }

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ;   public class Solution {    public static void main ( String [ ] args ) { FastReader fr = new FastReader ( ) ; int n = fr . nextInt ( ) ; int gmax = Integer . MIN_VALUE ; String [ ] s = new String [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { s [ i ] = fr . next ( ) ; } for ( int i = 0 ; i < n ; i ++ ) { int locamax = 0 ; for ( int j = i ; j < n ; j ++ ) { if ( s [ i ] . equals ( s [ j ] ) ) locamax ++ ; } if ( locamax > gmax ) gmax = locamax ; } System . out . println ( gmax ) ; } } class Pair { int val ; int idx ; Pair ( int val , int idx ) { this . val = val ; this . idx = idx ; } } 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 . * ; import java . util . * ; import java . math . * ; public class Main { public static void main ( String [ ] args ) throws java . lang . Exception {

n = int ( input ( ) )   columns = [ ] rows = [ ]   for r in range ( n ) : row = input ( ) rows . append ( row ) columnsneeded = [ i for i in range ( n ) if list ( row ) [ i ] == '0' ] columns . append ( columnsneeded )   res = [ ] for mvmt in columns : bigcnt = 0   for ro in rows : cnt = 0   for sweep in mvmt : if ro [ sweep ] == '0' : cnt += 1   elif ro [ sweep ] == '1' : continue   for nonsweep in [ bruh for bruh in range ( n ) if bruh not in mvmt ] : if ro [ nonsweep ] == '1' : cnt += 1   elif ro [ nonsweep ] == '0' : continue   if cnt == n : bigcnt += 1   res . append ( bigcnt )     print ( max ( res ) )     NEW_LINE

from collections import defaultdict n = int ( input ( ) ) a = [ ] k1 = [ ] c = 0 m = 0 for i in range ( n ) : a1 = list ( map ( str , input ( ) ) ) a . append ( a1 ) for i in range ( n ) : k = [ ] c = 0 for j in range ( n ) : if a [ i ] [ j ] == '0' : k . append ( j + 1 ) else : c += 1 if ( c == n ) : m += 1 if ( len ( k ) > 0 ) : r = int ( ' ' . join ( map ( str , k ) ) ) k1 . append ( r ) freq = defaultdict ( int ) ans = 0 for i in k1 : freq [ i ] += 1 ans = max ( ans , freq [ i ] ) if ( m > ans ) : print ( m ) else : print ( ans ) NEW_LINE

from sys import stdin , stdoutfrom os import pathrd = lambda : stdin . readline ( ) . strip ( ) wr = stdout . writeif ( path . exists ( ' input . txt ' ) ) : stdin = open ( " input . txt " , " r " ) import time NEW_LINE

n = int ( input ( ) )   a = [ ]   for i in range ( n ) : a . append ( input ( ) )   res = 0 for i in range ( n ) : count = 0 for j in range ( n ) : if a [ i ] == a [ j ] : count += 1 res = max ( res , count )   print ( res ) NEW_LINE


import java . util . ArrayList ; import java . util . Arrays ; import java . util . HashMap ; import java . util . List ; import java . util . Map ; import java . util . Scanner ;   public class Main {   public static void main ( String [ ] args ) {

import java . io . BufferedReader ; import java . io . FileReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Scanner ; import java . util . StringTokenizer ; import java . util . * ; import java . io . * ; public class codeforces { static class Student { int x , y ; Student ( int x , int y ) { this . x = x ; this . y = y ;

from sys import stdin , stdout , setrecursionlimitsetrecursionlimit ( 10 ** 5 ) from collections import defaultdictnmbr = lambda : int ( stdin . readline ( ) ) lst = lambda : list ( map ( int , stdin . readline ( ) . split ( ) ) ) PI = float ( ' inf ' ) def dfs ( src ) : vis [ src ] = 1 for neigh in g [ src ] : if neigh < src : if not vis [ neigh ] : dfs ( neigh ) dp [ src ] = max ( dp [ src ] , 1 + dp [ neigh ] ) for _ in range ( 1 ) : NEW_LINE

from collections import defaultdict   graph = defaultdict ( list ) n , m = list ( map ( int , input ( ) . split ( ) ) ) for i in range ( m ) : v , u = list ( map ( int , input ( ) . split ( ) ) ) graph [ v ] . append ( u ) graph [ u ] . append ( v ) dp = [ 1 ] * ( n + 1 ) ans = len ( graph [ 1 ] ) for i in range ( 2 , n + 1 ) : for v in graph [ i ] : if v < i : dp [ i ] = max ( dp [ i ] , dp [ v ] + 1 ) ans = max ( ans , dp [ i ] * len ( graph [ i ] ) )   print ( ans ) NEW_LINE

from sys import stdin , setrecursionlimit   setrecursionlimit ( 100000 )     class Graph : def __init__ ( self , No_of_nodes ) : self . n = No_of_nodes self . adj = [ [ ] for i in range ( self . n ) ]   def addEdge ( self , a , b ) : self . adj [ a ] . append ( b ) self . adj [ b ] . append ( a ) count [ a ] [ 0 ] += 1 count [ b ] [ 0 ] += 1     def solve ( start ) : for i in g . adj [ start ] : if i < start : dp [ start ] = max ( dp [ start ] , dp [ i ] + 1 ) return dp [ start ]     n , m = map ( int , stdin . readline ( ) . split ( ) ) g = Graph ( n ) count = [ [ 0 , i ] for i in range ( n ) ] dp = [ 1 ] * nfor i in range ( m ) : a , b = map ( int , stdin . readline ( ) . split ( ) ) a -= 1 b -= 1 g . addEdge ( a , b ) for i in range ( n ) : solve ( i ) ans = - 1000 for i in range ( n ) : if dp [ i ] != - 1 : ans = max ( ans , ( dp [ i ] ) * len ( g . adj [ i ] ) ) print ( ans ) NEW_LINE

n , m = map ( int , input ( ) . split ( ) )   G = [ [ ] for i in range ( n ) ] for i in range ( m ) : a , b = map ( int , input ( ) . split ( ) ) G [ a - 1 ] . append ( b - 1 ) G [ b - 1 ] . append ( a - 1 )   max_dist = 0 dist = [ 0 ] * nfor v in range ( n ) : dist [ v ] = 1 for u in G [ v ] : if ( u < v ) : dist [ v ] = max ( dist [ v ] , dist [ u ] + 1 ) ; max_dist = max ( max_dist , dist [ v ] * len ( G [ v ] ) ) ;   print ( max_dist ) NEW_LINE

n , m = map ( int , input ( ) . split ( ) ) A = [ [ ] for _ in range ( n + 1 ) ] B = [ 0 for _ in range ( n + 1 ) ] for i in range ( m ) : u , v = map ( int , input ( ) . split ( ) ) if u > v : u , v = v , u A [ u ] . append ( v ) B [ u ] += 1 B [ v ] += 1 C = [ 0 for _ in range ( n + 1 ) ] X = B [ 1 ] for u in range ( 1 , n + 1 ) : for v in A [ u ] : C [ v ] = max ( C [ v ] , C [ u ] + 1 ) X = max ( X , ( C [ v ] + 1 ) * B [ v ] ) print ( X ) NEW_LINE


import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . * ; import java . io . BufferedReader ; import java . io . InputStreamReader ;   public class First {   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 ( ) ;

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 = true ; static boolean memory = true ; static FastScanner f ; static PrintWriter pw ; static double eps = ( double ) 1e-6 ; static int oo = ( int ) 2e9 ;

import java . io . * ; import java . util . * ;     public class Main { public static int [ ] a = new int [ 2020 ] ; public static int gcd ( int a , int b ) { if ( a == 0 ) return b ; if ( b == 0 ) return a ; if ( a > b ) return gcd ( a % b , b ) ; return gcd ( b % a , a ) ; } public static void main ( String args [ ] ) { Scanner in ; PrintStream out ; try { in = new Scanner ( new FileInputStream ( " java . in " ) ) ; out = new PrintStream ( " java . out " ) ; } catch ( FileNotFoundException e ) { in = new Scanner ( new BufferedInputStream ( System . in ) ) ; out = System . out ; } int n = in . nextInt ( ) ; int cntOne = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { a [ i ] = in . nextInt ( ) ; if ( a [ i ] == 1 ) cntOne ++ ; } if ( cntOne > 0 ) { out . println ( n - cntOne ) ; return ; } int ans = - 1 ; for ( int i = 1 ; i <= n ; i ++ ) { int c = 0 ; for ( int j = i ; j <= n ; j ++ ) { if ( j == i ) c = a [ i ] ; else c = gcd ( c , a [ j ] ) ; if ( c == 1 ) { if ( ans == - 1 ) ans = j - i + n - 1 ; else ans = Math . min ( ans , j - i + n - 1 ) ; } } } out . println ( ans ) ; } }

def gcd ( a , b ) : if b == 0 : return a return gcd ( b , a % b ) n = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) c = 0 f = 0 if 1 in l : print ( n - l . count ( 1 ) ) else : while True : c += 1 for i in range ( n - c ) : a = gcd ( l [ i ] , l [ i + 1 ] ) if a == 1 : f = 1 break l [ i ] = a if f == 1 : break if c == n : break if f == 0 : print ( - 1 ) else : print ( c + n - 1 ) NEW_LINE

def gcd ( a , b ) : while b : a %= b a , b = b , a return an = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) g = l [ 0 ] for i in range ( 1 , n ) : g = gcd ( g , l [ i ] ) if g != 1 : print ( - 1 ) else : a = l . count ( 1 ) if a > 0 : print ( n - a ) else : ans = float ( ' inf ' ) for i in range ( n ) : g = l [ i ] for j in range ( i + 1 , n ) : g = gcd ( g , l [ j ] ) if g == 1 : d = j - i + n - 1 NEW_LINE


import java . io . * ; import java . util . * ;   public class YaroslavPermutations_296A { public static void main ( String [ ] args ) throws IOException { FastReader fr = new FastReader ( ) ; PrintWriter pr = new PrintWriter ( new OutputStreamWriter ( System . out ) ) ; int n = fr . nextInt ( ) ; PriorityQueue < Pair > pq = new PriorityQueue < > ( ( a , b ) -> b . y - a . y ) ; Map < Integer , Integer > map = new HashMap < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { int add = fr . nextInt ( ) ; map . putIfAbsent ( add , 0 ) ; map . put ( add , map . get ( add ) + 1 ) ; }   for ( Map . Entry < Integer , Integer > a : map . entrySet ( ) ) { if ( a . getValue ( ) > ( n + 1 ) / 2 ) { pr . println ( " NO " ) ; pr . close ( ) ; return ; } }   pr . println ( " YES " ) ; 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 . * ; import java . lang . * ; import java . io . * ;   public class FastIO { BufferedReader br ; StringTokenizer st ; public FastIO ( ) {

import java . util . * ; import java . math . * ; public class YaroslavPermutation { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int size = sc . nextInt ( ) ; int temp = size ; int [ ] arr = new int [ 1001 ] ; while ( temp -- > 0 ) { arr [ sc . nextInt ( ) ] ++ ; } Arrays . sort ( arr ) ; if ( arr [ 1000 ] == 1 ) System . out . println ( " YES " ) ; else { for ( int i = 0 ; i < 1001 ; i ++ ) { if ( arr [ i ] > ( ( size + 1 ) / 2 ) ) { System . out . println ( " NO " ) ; return ; } } System . out . println ( " YES " ) ; } } }

import java . util . HashMap ; import java . util . Scanner ;   public class A296 { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; HashMap < Integer , Integer > amounts = new HashMap < > ( ) ; int n = s . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) { int a = s . nextInt ( ) ; amounts . put ( a , amounts . containsKey ( a ) ? amounts . get ( a ) + 1 : 1 ) ;   } boolean answer = true ; for ( int i : amounts . values ( ) ) { if ( i > ( n + 1 ) / 2f ) { answer = false ; break ; } } System . out . println ( answer ? " YES " : " NO " ) ; } }

def solution ( ) : n = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) )   count = { } for i in arr : if i not in count : count [ i ] = 1 else : count [ i ] += 1   maxi = n / 2 if int ( maxi ) != maxi : maxi = int ( maxi ) + 1 mx = 0 for i in count : mx = max ( mx , count [ i ] ) if mx <= maxi : print ( ' YES ' ) else : print ( ' NO ' )     return 	 	       solution ( ) NEW_LINE

from collections import Countern = int ( input ( ) ) NEW_LINE

n = int ( input ( ) ) array = input ( ) . split ( ) c = ( n + 1 ) / 2 most_repeated = max ( set ( array ) , key = array . count ) counter = 0   for i in array : if ( i == most_repeated ) : counter += 1 else : continue   if ( c <= counter and n % 2 == 0 ) : print ( " NO " ) elif ( c < counter and n % 2 != 0 ) : print ( " NO " ) else : print ( " YES " ) NEW_LINE

from collections import Counter   n = int ( input ( ) ) x = list ( map ( int , input ( ) . split ( ) ) )   c = Counter ( x ) if 2 * max ( c . values ( ) ) > n + 1 : print ( " NO " ) else : print ( " YES " ) NEW_LINE

n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) flag = 0 dic = { } for i in a : if ( i not in dic ) : dic [ i ] = 1 else : dic [ i ] += 1 m = max ( dic . values ( ) )   if ( n == 1 ) : print ( " YES " ) elif ( n % 2 == 1 ) : if ( m > ( n // 2 ) + 1 ) : print ( ' NO ' ) else : print ( ' YES ' ) else : if ( m > ( n // 2 ) ) : print ( ' NO ' ) else : print ( ' YES ' ) NEW_LINE


import java . lang . * ; import java . util . * ; import java . io . * ;   public class CodeforcesB {   public void solve ( ) throws IOException { FastScanner fs = new FastScanner ( ) ; StringBuilder ans = new StringBuilder ( " " ) ; long n = fs . nextLong ( ) , d = fs . nextLong ( ) , m = fs . nextLong ( ) , l = fs . nextLong ( ) ; long x = 0 ; while ( x * d <= ( n - 1 ) * m + l ) { long h = x * d % m ; if ( h > l ) break ; x += ( l - h ) / d + 1 ; } ans . append ( x * d ) ; System . out . println ( ans ) ; } public static void main ( String [ ] args ) throws IOException { try { new CodeforcesB ( ) . solve ( ) ; } catch ( Exception e ) { e . printStackTrace ( ) ;   } } static class FastScanner { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( " " ) ; String next ( ) { while ( ! st . hasMoreTokens ( ) ) try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return st . nextToken ( ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } int [ ] readArray ( int n ) { int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextInt ( ) ; return a ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } } }

import java . util . * ;   public class CodeForces18B { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; long n = input . nextInt ( ) ; long d = input . nextInt ( ) ; long m = input . nextInt ( ) ; long l = input . nextInt ( ) ; for ( int i = 1 ; i <= n ; i ++ ) { long s1 = ( i - 1 ) * m + l ; long s2 = i * m ; long s3 = ( s1 / d ) * d + d ; if ( i == n || s3 < s2 ) { System . out . println ( s3 ) ; return ; } } } }

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

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 B18 {   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 , d , m , l = list ( map ( int , input ( ) . split ( ) ) ) a = 0 x = 0 for i in range ( n ) : x += ( ( l - a ) // d + 1 ) * d if x % m > l : break a = x % mprint ( x ) NEW_LINE

import systry : fin = open ( ' in ' ) except : fin = sys . stdininput = fin . readline   n , d , m , l = map ( int , input ( ) . split ( ) ) cur = 0 R = Nonefor i in range ( n ) : R = i * m + l NEW_LINE

import osimport sysfrom io import BytesIO , IOBasefrom typing import Textfrom collections import *     '''  2 ▁ 2 ▁ 5 ▁ 3 1 ▁ : ▁ 0,32 ▁ : ▁ 5 ,     ''' def main ( ) : n , d , m , l = map ( int , input ( ) . split ( ) ) Coordinate = 0 for i in range ( n ) : left = i * m right = i * m + l if ( Coordinate < left ) : print ( Coordinate ) exit ( 0 ) NumberOfMoves = ( ( right - Coordinate ) // d ) + 1 Coordinate += NumberOfMoves * d NEW_LINE


import java . util . * ; import java . math . * ; public class Mountain { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) * 2 ; int k = sc . nextInt ( ) ; int [ ] arr = new int [ n + 1 ] ; for ( int i = 0 ; i < n + 1 ; i ++ ) arr [ i ] = sc . nextInt ( ) ; for ( int i = 1 ; i < n ; i ++ ) { if ( arr [ i ] - 1 > arr [ i - 1 ] && arr [ i ] - 1 > arr [ i + 1 ] ) { k -- ; arr [ i ] -- ; } if ( k == 0 ) break ; } for ( int i = 0 ; i < n + 1 ; i ++ ) System . out . print ( arr [ i ] + " ▁ " ) ; } }

import java . util . * ; public class square { public static void main ( String ar [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) , k = sc . nextInt ( ) ; int [ ] height = new int [ 2 * n + 1 ] ; for ( int i = 0 ; i <= 2 * n ; i ++ ) height [ i ] = sc . nextInt ( ) ; for ( int i = 1 ; i <= 2 * n ; i += 2 ) { if ( height [ i ] - Math . max ( height [ i - 1 ] , height [ i + 1 ] ) >= 2 ) { height [ i ] -- ; k -- ; } if ( k == 0 ) break ; } for ( int x : height ) System . out . print ( x + " ▁ " ) ; System . out . println ( ) ; } }

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class MountainScenery {   public static void main ( String [ ] args ) { FastReader reader = new FastReader ( ) ;   int n = reader . nextInt ( ) ; int k = reader . nextInt ( ) ; int size = 2 * n + 1 ; int [ ] segment = new int [ size ] ; for ( int i = 0 ; i < size ; i ++ ) { segment [ i ] = reader . nextInt ( ) ; }   for ( int i = 1 ; i < size ; i += 2 ) { int current = segment [ i ] ; int previous = segment [ i - 1 ] ; int next = segment [ i + 1 ] ; if ( current - 1 > previous && current - 1 > next ) { segment [ i ] -= 1 ; k -- ; } if ( k == 0 ) break ; } for ( int i = 0 ; i < size ; i ++ ) { System . out . print ( segment [ i ] + " ▁ " ) ; } System . out . println ( ) ; }   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 ; } } }

n , k = map ( int , input ( ) . split ( ) ) ah = 2 * nl = list ( map ( int , input ( ) . split ( ) ) ) i = 1 while i < ah : if k == 0 : break if l [ i ] - l [ i - 1 ] > 1 and l [ i ] - l [ i + 1 ] > 1 : l [ i ] -= 1 k -= 1   i += 1 for j in l : print ( j , end = ' ▁ ' ) NEW_LINE

nk = input ( ) . strip ( ) . split ( ' ▁ ' ) n = int ( nk [ 0 ] ) k = int ( nk [ 1 ] )   pks = input ( ) . strip ( ) . split ( ' ▁ ' ) pks = [ int ( p ) for p in pks ]     for i in range ( 1 , 2 * n , 2 ) : if pks [ i ] - 1 > pks [ i - 1 ] and pks [ i ] - 1 > pks [ i + 1 ] : pks [ i ] -= 1 k -= 1 if k == 0 : breakfor i in range ( 2 * n + 1 ) : print ( pks [ i ] , end = ' ▁ ' ) NEW_LINE

n , k = map ( int , input ( ) . split ( ) ) arr = input ( ) . split ( ) original = [ ] count = 0 for i in range ( len ( arr ) ) : if ( i % 2 != 0 and count < k and int ( arr [ i ] ) - 1 > int ( arr [ i + 1 ] ) and int ( arr [ i ] ) - 1 > int ( arr [ i - 1 ] ) ) : original . append ( int ( arr [ i ] ) - 1 ) count += 1 else : original . append ( int ( arr [ i ] ) ) print ( " ▁ " . join ( map ( str , original ) ) ) NEW_LINE

inn = list ( map ( int , input ( ) . split ( " ▁ " ) ) ) mnts = list ( map ( int , input ( ) . split ( " ▁ " ) ) ) pks = inn [ 0 ] cngd = inn [ 1 ] k = [ ] for i in range ( 1 , len ( mnts ) - 1 ) : if mnts [ i ] > ( mnts [ i - 1 ] + 1 ) and mnts [ i ] > ( mnts [ i + 1 ] + 1 ) : k . append ( i ) for j in range ( cngd ) : mnts [ k [ j ] ] = mnts [ k [ j ] ] - 1 print ( " ▁ " . join ( map ( str , mnts ) ) ) NEW_LINE

n , k = map ( int , input ( ) . split ( ) ) arr = [ int ( x ) for x in input ( ) . split ( ) ]   NEW_LINE


# include < bits / stdc ++ . h > using namespace std ; int main ( ) {

import java . io . * ; import java . util . * ;   public class Trains { static long gcd ( long a , long b ) { if ( b == 0 ) return a ; else return gcd ( b , a % b ) ; }   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; long a = in . nextInt ( ) ; long b = in . nextInt ( ) ; long m = ( a * b ) ; long aa = m / a ; long bb = m / b ; if ( a < b ) { if ( gcd ( a , b ) > 1 ) aa -= gcd ( a , b ) ; else aa -- ; } else { if ( gcd ( a , b ) > 1 ) bb -= gcd ( a , b ) ; else bb -- ; } if ( aa == bb ) out . println ( " Equal " ) ; else if ( aa > bb ) out . println ( " Dasha " ) ; else out . println ( " Masha " ) ; out . close ( ) ; } }

# include < bits / stdc ++ . h > using namespace std ;  # define int long long # define ull unsigned long long # define ld long double # define mem ( a , b ) memset ( a , ( b ) , sizeof ( a ) ) # define rep ( i , j , k ) for ( int i = j ; i < k ; ++ i ) # define rrep ( i , j , k ) for ( int i = j ; i > k ; -- i ) # define all ( cont ) cont . begin ( ) , cont . end ( ) # define rall ( cont ) cont . end ( ) , cont . begin ( ) # define foreach ( i , a ) for ( auto i : a ) # define forEach ( it , l ) for ( auto it = l . begin ( ) ; it != l . end ( ) ; it ++ ) # define in ( A , B , C ) assert ( B <= A && A <= C ) # define debug ( a ) cout << # a << " : ▁ " << a << endl # define flag ( n ) cout << " here ▁ " << n << endl # define w ( x ) int x ; cin >> x ; while ( x -- ) # define mp make_pair # define pb push_back  # define endl ' \n ' ; # define io ios_base :: sync_with_stdio ( false ) ; cin . tie ( NULL ) ; cout . tie ( NULL ) ;    # define TRACE # ifdef TRACE # define see ( ... ) __f ( # __VA_ARGS__ , __VA_ARGS__ ) ; template < typename Arg1 > void __f ( const char * name , Arg1 && arg1 ) { cerr << name << " ▁ : ▁ " << arg1 << endl ; } template < typename Arg1 , typename ... Args > void __f ( const char * names , Arg1 && arg1 , Args && ... args ) { const char * comma = strchr ( names + 1 , ' , ' ) ; cerr . write ( names , comma - names ) << " ▁ : ▁ " << arg1 << " ▁ | ▁ " ; __f ( comma + 1 , args ... ) ; } # else # endif   const int POSITIVE_INFINITY = 9223372036854775807 ; const int NEGATIVE_INFINITY = - 9223372036854775807 ; const ld PI = acos ( - 1.0 ) ; const int MOD = 1000000007 ; const int INF = 1e18 ; const int N = 1e6 + 5 ;    int32_t main ( ) { io ;

from math import gcd NEW_LINE def lcm ( a , b ) : return ( a * b ) // gcd ( a , b ) NEW_LINE i = 0 NEW_LINE a , b = map ( int , input ( ) . split ( ) ) NEW_LINE first = Falsesecond = False NEW_LINE masha = 0 NEW_LINE dasha = 0 NEW_LINE while i < lcm ( a , b ) : if NEW_LINE first : masha += b - ( i % b ) NEW_LINE i += b - ( i % b ) elif second : dasha += a - ( i % a ) NEW_LINE i += a - ( i % a ) NEW_LINE if i % a == 0 and i % b == 0 : if NEW_LINE a > b : first = True NEW_LINE second = False else : first = False NEW_LINE second = True elif first : second = True NEW_LINE first = False else : first = True NEW_LINE second = False NEW_LINE if masha > dasha : NEW_LINE INDENT print ( " Dasha " ) elif dasha > masha : NEW_LINE print ( " Masha " ) else : NEW_LINE print ( " Equal " ) NEW_LINE DEDENT

def mcd ( a , b ) : while NEW_LINE b != 0 : a , b = b , a % b NEW_LINE return a   datos = input ( ) . split ( ) NEW_LINE d = int ( datos [ 0 ] ) NEW_LINE m = int ( datos [ 1 ] )   mcd = mcd ( d , m ) NEW_LINE if abs ( d - m ) == 1 or d - m == mcd or m - d == mcd : NEW_LINE INDENT print ( ' Equal ' ) elif d - m > 0 : NEW_LINE print ( ' Masha ' ) else : NEW_LINE print ( ' Dasha ' ) NEW_LINE DEDENT


import java . util . Scanner ; public class CodeForces { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; for ( int i = 0 ; i < t ; i ++ ) { int n = sc . nextInt ( ) ; String s = " " ; for ( int j = 0 ; j < n ; j ++ ) { s += sc . next ( ) ; } boolean isTrue = true ; while ( s . length ( ) > 0 ) { String s1 = s . substring ( 0 , 1 ) ; int count = 0 ; for ( int j = 0 ; j < s . length ( ) ; j ++ ) { if ( s1 . equals ( s . substring ( j , j + 1 ) ) ) count ++ ; } s = s . replace ( s1 , " " ) ; if ( count >= n ) { if ( n % 2 == 0 ) { if ( count % 2 != 0 ) isTrue = false ; } else { if ( count % n != 0 ) isTrue = false ; } } else { isTrue = false ; break ; } } if ( isTrue ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } }

import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; for ( int i = 0 ; i < a ; i ++ ) { int n = sc . nextInt ( ) ; int [ ] arr = new int [ 26 ] ; for ( int j = 0 ; j < n ; j ++ ) { String s = sc . next ( ) ; for ( int k = 0 ; k < s . length ( ) ; k ++ ) { int as = s . charAt ( k ) - ' a ' ; arr [ as ] += 1 ; } } boolean c = false ; for ( int j = 0 ; j < 26 ; j ++ ) { if ( arr [ j ] % n != 0 ) { c = true ; break ; } else { c = false ; } } System . out . println ( ! c ? " YES " : " NO " ) ; } } }

import java . util . * ; public class question { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; for ( int l = 0 ; l < t ; l ++ ) { int n = sc . nextInt ( ) ; HashMap < Character , Integer > h = new HashMap < > ( ) ; int count = 0 , e = 0 ; for ( int k = 0 ; k < n ; k ++ ) { String s = sc . next ( ) ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { char ch = s . charAt ( i ) ; if ( ! h . containsKey ( ch ) ) h . put ( ch , 1 ) ; else { int v = h . get ( ch ) + 1 ; h . put ( ch , v ) ; } } } for ( char ch : h . keySet ( ) ) { if ( h . get ( ch ) % n == 0 ) count ++ ; else { e ++ ; System . out . println ( " NO " ) ; break ; } } if ( e == 0 ) System . out . println ( " YES " ) ; } } }

t = int ( input ( ) ) NEW_LINE while t : NEW_LINE INDENT n = int ( input ( ) ) NEW_LINE s = " " NEW_LINE for i in range ( 0 , n ) : NEW_LINE INDENT s += str ( input ( ) ) NEW_LINE DEDENT s = sorted ( s ) NEW_LINE c = True NEW_LINE for i in range ( ord ( s [ 0 ] ) , ord ( s [ len ( s ) - 1 ] ) + 1 ) : NEW_LINE INDENT if s . count ( chr ( i ) ) % n != 0 : NEW_LINE INDENT c = False NEW_LINE break NEW_LINE DEDENT DEDENT if c == True : NEW_LINE INDENT print ( " YES " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " NO " ) NEW_LINE DEDENT t -= 1 NEW_LINE DEDENT

from collections import Counter NEW_LINE for i in range ( int ( input ( ) ) ) : NEW_LINE INDENT s = ' ' NEW_LINE n = int ( input ( ) ) NEW_LINE for j in range ( n ) : NEW_LINE INDENT s += input ( ) NEW_LINE DEDENT s = list ( s ) NEW_LINE cun = Counter ( ) NEW_LINE cun . update ( s ) NEW_LINE res = 0 NEW_LINE for k in cun : NEW_LINE INDENT if ( cun [ k ] % n == 0 ) : NEW_LINE INDENT res += 1 NEW_LINE DEDENT DEDENT if ( res == len ( cun ) ) : NEW_LINE INDENT print ( ' YES ' ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " NO " ) NEW_LINE DEDENT DEDENT

t = int ( input ( ) ) NEW_LINE for i in range ( t ) : NEW_LINE INDENT d = { } NEW_LINE n = int ( input ( ) ) NEW_LINE for j in range ( n ) : NEW_LINE INDENT s = input ( ) NEW_LINE for letter in s : NEW_LINE INDENT if letter in d : NEW_LINE INDENT d [ letter ] += 1 NEW_LINE DEDENT else : NEW_LINE INDENT d [ letter ] = 1 NEW_LINE DEDENT DEDENT DEDENT all_count = True NEW_LINE for k in d . values ( ) : NEW_LINE INDENT if k % n != 0 : NEW_LINE INDENT all_count = False NEW_LINE DEDENT DEDENT if not all_count : NEW_LINE INDENT print ( " no " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " yes " ) NEW_LINE DEDENT DEDENT

from collections import Counter NEW_LINE t = int ( input ( ) ) NEW_LINE for _ in range ( t ) : NEW_LINE INDENT n = int ( input ( ) ) NEW_LINE c = Counter ( ) NEW_LINE for i in range ( n ) : NEW_LINE INDENT s = input ( ) NEW_LINE for j in s : NEW_LINE INDENT c [ j ] += 1 NEW_LINE DEDENT DEDENT f = 0 NEW_LINE for i in c : NEW_LINE INDENT if ( c [ i ] % n != 0 ) : NEW_LINE INDENT f = 1 NEW_LINE break NEW_LINE DEDENT DEDENT if ( f == 0 ) : NEW_LINE INDENT print ( " YES " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " NO " ) NEW_LINE DEDENT DEDENT

import sys NEW_LINE input = sys . stdin . readline NEW_LINE import math NEW_LINE for _ in range ( int ( input ( ) ) ) : NEW_LINE INDENT n = int ( input ( ) ) NEW_LINE s = " " NEW_LINE for i in range ( n ) : NEW_LINE INDENT s += input ( ) NEW_LINE DEDENT b = [ 0 ] * 200 NEW_LINE for i in s : NEW_LINE INDENT b [ ord ( i ) ] += 1 NEW_LINE DEDENT ok = 1 NEW_LINE for i in range ( len ( b ) ) : NEW_LINE INDENT if b [ i ] % n != 0 : NEW_LINE INDENT ok = 0 NEW_LINE DEDENT DEDENT if ok == 0 : NEW_LINE INDENT print ( " NO " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " YES " ) NEW_LINE DEDENT DEDENT


# include < bits / stdc ++ . h > using namespace std ;  # define fastio ios_base :: sync_with_stdio ( false ) ; cin . tie ( NULL ) ; cout . tie ( NULL ) ; # define fr ( i , k ) for ( i = 0 ; i < k ; i ++ ) # define deb ( x ) cerr << # x << " ▁ ▁ = ▁ " << x << endl ; # define deb2 ( x , y ) cerr << # x << " ▁ = ▁ " << x << " ▁ ▁ " << # y << " ▁ = ▁ " << y << endl ; # define print ( x ) for ( auto k : x ) cout << k << " ▁ " ; cout << endl ; # define SZ ( x ) ( x ) . size ( ) ; # define ll long long # define mod 1000000007 # define ff first # define ss second # define pb push_back # define em emplace_back # define ulli unsigned long long int # define inf 1e18 # define endl " \n " typedef vector < vector < ll >> vvll ; typedef vector < ll > vll ; typedef vector < pair < ll , ll >> vpll ; typedef pair < ll , ll > pll ; typedef vector < bool > vb ; void solve ( ) ; void pre ( ) ;    int main ( ) { fastio ; # ifndef ONLINE_JUDGE freopen ( " input . txt " , " r " , stdin ) ; freopen ( " output . txt " , " w " , stdout ) ; # endif   ll t ; t = 1 ;   cin >> t ; for ( ll test = 1 ; test <= t ; test ++ ) {

import bisectimport collectionsimport copyimport functoolsimport heapqimport itertoolsimport mathimport randomimport reimport sysimport timeimport stringfrom typing import Listsys . setrecursionlimit ( 99999 )   for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) if n < 5 : print ( "0 ▁ 0 ▁ 0" ) continue g , s , b = 0 , 0 , 0 score = [ [ arr [ 0 ] , 1 ] ] for c in arr [ 1 : ] : if c == score [ - 1 ] [ 0 ] : score [ - 1 ] [ 1 ] += 1 else : score . append ( [ c , 1 ] )   g = score [ 0 ] [ 1 ] j = 1 while s <= g and j < len ( score ) : s += score [ j ] [ 1 ] j += 1 while j < len ( score ) and ( g + s + b + score [ j ] [ 1 ] ) <= n // 2 : b += score [ j ] [ 1 ] j += 1 if g > 0 and s > 0 and b > 0 and g < s and g < b : print ( g , s , b ) continue else : print ( "0 ▁ 0 ▁ 0" ) continue NEW_LINE

from sys import stdininput = stdin . readline for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) p = list ( map ( int , input ( ) . split ( ) ) ) l , cou , x = p [ 0 ] , 1 , [ ] for i in range ( 1 , n // 2 + 1 ) : if l != p [ i ] : l = p [ i ] x . append ( cou ) cou = 0 cou += 1 if len ( x ) < 3 : print ( 0 , 0 , 0 ) else : a , b , c , fl = x [ 0 ] , 0 , 0 , 0 for j in range ( 1 , len ( x ) ) : if not fl : b += x [ j ] else : c += x [ j ] if b > a : fl = 1 if a < b and a < c : print ( a , b , c ) else : print ( 0 , 0 , 0 ) NEW_LINE


import java . util . * ; public class BoboniuLikestoColorBalls { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { long r = sc . nextLong ( ) , g = sc . nextLong ( ) , b = sc . nextLong ( ) , w = sc . nextLong ( ) , c = 0 , c1 = 0 ; if ( r % 2 == 0 && r > 0 ) c ++ ; if ( g % 2 == 0 && g > 0 ) c ++ ; if ( b % 2 == 0 && b > 0 ) c ++ ; if ( r == 0 ) c1 ++ ; if ( g == 0 ) c1 ++ ; if ( b == 0 ) c1 ++ ; if ( c1 == 3 || ( c1 == 1 && c == 2 ) || ( c1 == 1 && c == 1 && w % 2 == 0 ) || ( c1 == 2 && c == 1 ) || ( c1 == 2 && c == 0 && w % 2 == 0 ) ) System . out . println ( " YES " ) ; else if ( w == 0 && c == 2 ) System . out . println ( " YES " ) ; else if ( r > 0 && b > 0 && g > 0 ) { if ( c == 3 || c == 0 || ( c == 1 && w % 2 != 0 ) || ( c == 2 && w % 2 == 0 ) ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } else System . out . println ( " NO " ) ; } } }

import java . util . Scanner ; public class _0621BoboniuLikestoColorBalls { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int cases = sc . nextInt ( ) ; while ( cases > 0 ) { int r = sc . nextInt ( ) ; int g = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int w = sc . nextInt ( ) ; int min = Math . min ( r , Math . min ( b , g ) ) ; if ( r % 2 == 0 && g % 2 == 0 && b % 2 == 0 ) { System . out . println ( " YES " ) ; } else if ( r % 2 != 0 && g % 2 != 0 && b % 2 != 0 && min >= 1 ) { System . out . println ( " YES " ) ; } else { int count = 0 ; if ( r % 2 != 0 ) { count ++ ; } if ( g % 2 != 0 ) { count ++ ; } if ( b % 2 != 0 ) { count ++ ; } if ( count == 2 && min >= 1 && w % 2 != 0 ) { System . out . println ( " YES " ) ; } else if ( count == 1 && w % 2 == 0 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } cases -- ; } } }

import java . util . Scanner ; public class Div2A { private static boolean areValid ( int a , int b , int c , int d ) { int paritySum = ( a % 2 ) + ( b % 2 ) + ( c % 2 ) + ( d % 2 ) ; return a >= 0 && b >= 0 && c >= 0 && d >= 0 && paritySum <= 1 ; } public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int t = Integer . parseInt ( scanner . nextLine ( ) ) ; int r ; int g ; int b ; int w ; for ( int i = 0 ; i < t ; i ++ ) { r = scanner . nextInt ( ) ; g = scanner . nextInt ( ) ; b = scanner . nextInt ( ) ; w = scanner . nextInt ( ) ; scanner . nextLine ( ) ; if ( areValid ( r , g , b , w ) || areValid ( r - 1 , g - 1 , b - 1 , w + 1 ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } scanner . close ( ) ; } }

import java . io . * ; import java . util . StringTokenizer ; public class BoboniuLikesToColorBalls { public static void main ( String [ ] args ) { FastReader in = new FastReader ( ) ; PrintWriter out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ; int t = in . nextInt ( ) ; while ( t -- > 0 ) { int odds = 0 ; int zero = 0 ; int [ ] arr = new int [ 4 ] ; for ( int i = 0 ; i < 4 ; i ++ ) { arr [ i ] = in . nextInt ( ) ; if ( arr [ i ] % 2 != 0 ) odds ++ ; if ( arr [ i ] == 0 && i != 3 ) zero ++ ; } if ( odds <= 1 ) out . println ( " Yes " ) ; else if ( zero != 0 ) out . println ( " No " ) ; else { odds = 0 ; zero = 0 ; for ( int i = 0 ; i < 3 ; i ++ ) arr [ i ] -= 1 ; arr [ 3 ] += 3 ; for ( int i = 0 ; i < 4 ; i ++ ) { if ( arr [ i ] % 2 != 0 ) odds ++ ; if ( arr [ i ] == 0 && i != 3 ) zero ++ ; } if ( odds <= 1 ) out . println ( " Yes " ) ; else out . println ( " No " ) ; } } out . close ( ) ; } private static class FastReader { BufferedReader br ; StringTokenizer st ; 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 ( ) ) ; } } }

t = int ( input ( ) ) NEW_LINE for a in range ( t ) : NEW_LINE INDENT r , g , b , w = map ( int , input ( ) . split ( ) ) NEW_LINE flag = False NEW_LINE if ( r + g + b + w ) % 2 == 0 : NEW_LINE INDENT if r % 2 == 0 and g % 2 == 0 and b % 2 == 0 and w % 2 == 0 : NEW_LINE INDENT flag = True NEW_LINE DEDENT else : NEW_LINE INDENT while ( r > 0 and g > 0 and b > 0 ) : NEW_LINE INDENT r -= 1 NEW_LINE g -= 1 NEW_LINE b -= 1 NEW_LINE w += 3 NEW_LINE if r % 2 == 0 and g % 2 == 0 and b % 2 == 0 and w % 2 == 0 : NEW_LINE INDENT flag = True NEW_LINE DEDENT break NEW_LINE DEDENT DEDENT DEDENT else : NEW_LINE INDENT if ( r % 2 == 0 and g % 2 == 0 and b % 2 == 0 and w % 2 == 1 ) or ( r % 2 == 0 and g % 2 == 0 and b % 2 == 1 and w % 2 == 0 ) or ( r % 2 == 0 and g % 2 == 1 and b % 2 == 0 and w % 2 == 0 ) or ( r % 2 == 1 and g % 2 == 0 and b % 2 == 0 and w % 2 == 0 ) : NEW_LINE INDENT flag = True NEW_LINE DEDENT else : NEW_LINE INDENT while ( r > 0 and g > 0 and b > 0 ) : NEW_LINE INDENT r -= 1 NEW_LINE g -= 1 NEW_LINE b -= 1 NEW_LINE w += 3 NEW_LINE if ( r % 2 == 0 and g % 2 == 0 and b % 2 == 0 and w % 2 == 1 ) or ( r % 2 == 0 and g % 2 == 0 and b % 2 == 1 and w % 2 == 0 ) or ( r % 2 == 0 and g % 2 == 1 and b % 2 == 0 and w % 2 == 0 ) or ( r % 2 == 1 and g % 2 == 0 and b % 2 == 0 and w % 2 == 0 ) : NEW_LINE INDENT flag = True NEW_LINE DEDENT break NEW_LINE DEDENT DEDENT DEDENT if ( flag ) : NEW_LINE INDENT print ( " Yes " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " No " ) NEW_LINE DEDENT DEDENT

def check ( r , g , b , w ) : NEW_LINE INDENT if r < 0 or g < 0 or b < 0 or w < 0 : NEW_LINE INDENT return - 1 NEW_LINE DEDENT else : NEW_LINE INDENT count = 0 NEW_LINE count1 = 0 NEW_LINE if r % 2 == 0 : NEW_LINE INDENT count += 1 NEW_LINE DEDENT else : NEW_LINE INDENT count1 += 1 NEW_LINE DEDENT if g % 2 == 0 : NEW_LINE INDENT count += 1 NEW_LINE DEDENT else : NEW_LINE INDENT count1 += 1 NEW_LINE DEDENT if b % 2 == 0 : NEW_LINE INDENT count += 1 NEW_LINE DEDENT else : NEW_LINE INDENT count1 += 1 NEW_LINE DEDENT if w % 2 == 0 : NEW_LINE INDENT count += 1 NEW_LINE DEDENT else : NEW_LINE INDENT count1 += 1 NEW_LINE DEDENT if count == 4 and count1 == 0 : NEW_LINE INDENT return 1 NEW_LINE DEDENT elif count == 3 and count1 == 1 : NEW_LINE INDENT return 1 NEW_LINE DEDENT else : NEW_LINE INDENT return - 1 NEW_LINE DEDENT DEDENT DEDENT t = int ( input ( ) ) NEW_LINE for i in range ( t ) : NEW_LINE INDENT r , g , b , w = map ( int , input ( ) . split ( ) ) NEW_LINE if check ( r , g , b , w ) == 1 : NEW_LINE INDENT print ( " YES " ) NEW_LINE DEDENT else : NEW_LINE INDENT w += 3 NEW_LINE r -= 1 NEW_LINE g -= 1 NEW_LINE b -= 1 NEW_LINE if check ( r , g , b , w ) == 1 : NEW_LINE INDENT print ( " YES " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " No " ) NEW_LINE DEDENT DEDENT DEDENT

t = int ( input ( ) ) NEW_LINE for _ in range ( t ) : NEW_LINE INDENT r , g , b , w = map ( int , input ( ) . split ( ) ) NEW_LINE max_op = min ( r , g , b ) NEW_LINE even_count = 0 NEW_LINE if r % 2 == 0 : NEW_LINE INDENT even_count += 1 NEW_LINE DEDENT if g % 2 == 0 : NEW_LINE INDENT even_count += 1 NEW_LINE DEDENT if b % 2 == 0 : NEW_LINE INDENT even_count += 1 NEW_LINE DEDENT if even_count == 3 or even_count == 0 : NEW_LINE INDENT print ( ' Yes ' ) NEW_LINE DEDENT elif even_count == 2 : NEW_LINE INDENT if w % 2 == 1 : NEW_LINE INDENT print ( ' No ' ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( ' Yes ' ) NEW_LINE DEDENT DEDENT else : NEW_LINE INDENT if w % 2 == 0 : NEW_LINE INDENT print ( ' No ' ) NEW_LINE DEDENT else : NEW_LINE INDENT if max_op >= 1 : NEW_LINE INDENT print ( ' Yes ' ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( ' No ' ) NEW_LINE DEDENT DEDENT DEDENT DEDENT

import math NEW_LINE import sys NEW_LINE import collections NEW_LINE import bisect NEW_LINE import time NEW_LINE def get_ints ( ) : return map ( int , sys . stdin . readline ( ) . strip ( ) . split ( ) ) NEW_LINE def get_list ( ) : return list ( map ( int , sys . stdin . readline ( ) . strip ( ) . split ( ) ) ) NEW_LINE def get_string ( ) : return sys . stdin . readline ( ) . strip ( ) NEW_LINE for t in range ( int ( input ( ) ) ) : NEW_LINE INDENT r , g , b , w = get_ints ( ) NEW_LINE ans = [ r , g , b , w ] NEW_LINE odd = 0 NEW_LINE for i in ans : NEW_LINE INDENT if i % 2 == 1 : NEW_LINE INDENT odd += 1 NEW_LINE DEDENT DEDENT if odd <= 1 : NEW_LINE INDENT print ( " Yes " ) NEW_LINE continue NEW_LINE DEDENT change = min ( r , g , b , 1 ) NEW_LINE r -= change NEW_LINE g -= change NEW_LINE b -= change NEW_LINE w += change NEW_LINE ans = [ r , g , b , w ] NEW_LINE odd = 0 NEW_LINE for i in ans : NEW_LINE INDENT if i % 2 == 1 : NEW_LINE INDENT odd += 1 NEW_LINE DEDENT DEDENT if odd <= 1 : NEW_LINE INDENT print ( " Yes " ) NEW_LINE continue NEW_LINE DEDENT print ( " No " ) NEW_LINE DEDENT

def numOfOdd ( * args ) : NEW_LINE INDENT num = 0 NEW_LINE for col in args : NEW_LINE INDENT if col % 2 != 0 : NEW_LINE INDENT num += 1 NEW_LINE DEDENT DEDENT return num NEW_LINE DEDENT for _ in range ( int ( input ( ) ) ) : NEW_LINE INDENT r , g , b , w = map ( int , input ( ) . split ( ) ) NEW_LINE nOdd = numOfOdd ( r , g , b , w ) NEW_LINE if r == 0 or g == 0 or b == 0 : NEW_LINE INDENT if numOfOdd ( r , g , b , w ) == 1 or numOfOdd ( r , g , b , w ) == 0 : NEW_LINE INDENT print ( " Yes " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " No " ) NEW_LINE DEDENT DEDENT else : NEW_LINE INDENT if nOdd == 2 : NEW_LINE INDENT print ( " No " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " Yes " ) NEW_LINE DEDENT DEDENT DEDENT