import heapq
t = int ( input ( ) )
class A : __slots__ = 'a' def __init__ ( self, a) : self. a = adef __lt__ ( self, rhs: 'A' ) : return self. a > rhs. a
hq = [ ]
for _ in range ( t) : str = input ( ) . split( ) if len ( str ) == 2 : heapq. heappush( hq, A( int ( str [ 1 ] ) ) ) else : if str [ 0 ] == 'pop' and hq: print ( heapq. heappop( hq) . a) else : if hq: print ( hq[ 0 ] . a) else : print ( 'empty' )
from collections import deque
dq = deque( )
lgh, t = map ( int , input ( ) . split( ) )
for _ in range ( t) : s = input ( ) . split( ) if len ( s) == 2 : if len ( dq) == lgh: print ( 'full' ) else : dq. append( int ( s[ 1 ] ) ) if s[ 0 ] == 'pop' : if len ( dq) == 0 : print ( 'empty' ) else : print ( dq. popleft( ) ) if s[ 0 ] == 'front' : if len ( dq) == 0 : print ( 'empty' ) else : print ( dq[ 0 ] )
t = int ( input ( ) )
a = [ ]
for _ in range ( t) : s = input ( ) . split( ) if s[ 0 ] == 'insert' : x, y = int ( s[ 1 ] ) , int ( s[ 2 ] ) if x in a: a. insert( a. index( x) , y) else : a. append( y) elif s[ 0 ] == 'delete' : x = int ( s[ 1 ] ) if x in a: a. remove( x)
print ( ' ' . join( map ( str , a) ) if a else 'NULL' )
from collections import deque
stk = deque( )
t = int ( input ( ) )
for _ in range ( t) : s = input ( ) . split( ) if s[ 0 ] == 'push' : stk. append( s[ 1 ] ) elif s[ 0 ] == 'pop' : if stk: print ( stk. pop( ) ) else : print ( 'error' ) elif s[ 0 ] == 'top' : if stk: print ( stk[ - 1 ] ) else : print ( 'error' )
from collections import deque
q = deque()
t = int(input())
for _ in range(t):s = input().split()if s[0] == 'push':q.appendleft(int(s[1]))elif s[0] == 'pop':if q:print(q.pop())else:print('error')elif s[0] == 'front':if q:print(q[-1])else:print('error')
n, m = map ( int , input ( ) . split( ) )
p = [ _ for _ in range ( n + 1 ) ]
sz = [ 1 ] * ( n + 1 )
def find ( x) : if x == p[ x] : return xp[ x] = find( p[ x] ) return p[ x]
def union ( x, y) : x = find( x) y = find( y) if x == y: return if sz[ x] < sz[ y] : x, y = y, xp[ y] = xsz[ x] += sz[ y]
for _ in range ( m) : a, b = map ( int , input ( ) . split( ) ) union( a, b)
for i in range ( 1 , n + 1 ) : find( i)
print ( len ( set ( p) ) - 1 , max ( sz) )