#include <stdio.h>
#include <stdlib.h>

int FUNC00 ( ) {
    int VAR00 = 0 ;
    int VAR01 = getchar_unlocked ( ) ;
    if ( VAR01 < 48 || 57 < VAR01 ) return VAR01 ;
    while ( 47 < VAR01 && VAR01 < 58 ) {
        VAR00 = 10 * VAR00 + ( VAR01 & 0xf ) ;
        VAR01 = getchar_unlocked ( ) ;
    }
    return VAR00 ;
}
int FUNC01 ( char * ARG00 ) {
    int VAR02 ;
    while ( ( VAR02 = getchar_unlocked ( ) ) > 32 ) * ARG00 ++ = ( char ) VAR02 ;
    * ARG00 = 0 ;
    return VAR02 ;
}
void FUNC02 ( int ARG01 ) {
    if ( ! ARG01 ) {
        putchar_unlocked ( '0' ) ;
        return ;
    }
    char VAR03 [ 11 ] ;
    int VAR04 = 0 ;
    while ( ARG01 ) VAR03 [ VAR04 ++ ] = ( char ) ( ARG01 % 10 + '0' ) , ARG01 /= 10 ;
    while ( VAR04 -- ) putchar_unlocked ( VAR03 [ VAR04 ] ) ;
}
void FUNC03 ( char * ARG02 ) { while ( * ARG02 ) putchar_unlocked ( * ARG02 ++ ) ; }

typedef struct STRUCT00 {
    int MEMBER00 ;
    int MEMBER01 ;
    struct STRUCT00 * MEMBER02 , * MEMBER03 ;
} STRUCT00 ;
typedef struct STRUCT01 {
    STRUCT00 * MEMBER04 ;
    size_t MEMBER05 ;
} STRUCT01 ;
void FUNC04 ( STRUCT01 * ARG03 ) {
    ARG03 -> MEMBER04 = NULL ;
    ARG03 -> MEMBER05 = 0 ;
}
STRUCT00 * FUNC05 ( STRUCT00 * ARG04 ) {
    STRUCT00 * VAR05 = ARG04 -> MEMBER02 ;
    ARG04 -> MEMBER02 = VAR05 -> MEMBER03 ;
    VAR05 -> MEMBER03 = ARG04 ;
    return VAR05 ;
}
STRUCT00 * FUNC06 ( STRUCT00 * ARG05 ) {
    STRUCT00 * VAR06 = ARG05 -> MEMBER03 ;
    ARG05 -> MEMBER03 = VAR06 -> MEMBER02 ;
    VAR06 -> MEMBER02 = ARG05 ;
    return VAR06 ;
}
STRUCT00 * FUNC07 ( STRUCT00 * ARG06 , int ARG07 , int ARG08 ) {
    if ( ARG06 == NULL ) {
        STRUCT00 * VAR07 = malloc ( sizeof ( STRUCT00 ) ) ;
        VAR07 -> MEMBER00 = ARG07 ;
        VAR07 -> MEMBER01 = ARG08 ;
        VAR07 -> MEMBER02 = VAR07 -> MEMBER03 = NULL ;
        return VAR07 ;
    }
    if ( ARG07 == ARG06 -> MEMBER00 ) return ARG06 ;
    if ( ARG07 < ARG06 -> MEMBER00 ) {
        ARG06 -> MEMBER02 = FUNC07 ( ARG06 -> MEMBER02 , ARG07 , ARG08 ) ;
        if ( ARG06 -> MEMBER01 < ARG06 -> MEMBER02 -> MEMBER01 ) ARG06 = FUNC05 ( ARG06 ) ;
    } else {
        ARG06 -> MEMBER03 = FUNC07 ( ARG06 -> MEMBER03 , ARG07 , ARG08 ) ;
        if ( ARG06 -> MEMBER01 < ARG06 -> MEMBER03 -> MEMBER01 ) ARG06 = FUNC06 ( ARG06 ) ;
    }
    return ARG06 ;
}
void FUNC08 ( STRUCT01 * ARG09 , int ARG10 , int ARG11 ) {
    ARG09 -> MEMBER04 = FUNC07 ( ARG09 -> MEMBER04 , ARG10 , ARG11 ) ;
    ARG09 -> MEMBER05 ++ ;
}
STRUCT00 * FUNC09 ( const STRUCT00 * ARG12 , const int ARG13 ) {
    while ( ARG12 != NULL && ARG12 -> MEMBER00 != ARG13 ) {
        if ( ARG13 < ARG12 -> MEMBER00 ) ARG12 = ARG12 -> MEMBER02 ;
        else ARG12 = ARG12 -> MEMBER03 ;
    }
    return ARG12 ;
}
STRUCT00 * FUNC10 ( STRUCT00 * ARG14 ) {
    while ( ARG14 -> MEMBER02 != NULL ) ARG14 = ARG14 -> MEMBER02 ;
    return ARG14 ;
}
STRUCT00 * FUNC11 ( STRUCT00 * ARG15 , int ARG16 ) {
    if ( ARG15 == NULL ) return NULL ;
    if ( ARG16 < ARG15 -> MEMBER00 ) ARG15 -> MEMBER02 = FUNC11 ( ARG15 -> MEMBER02 , ARG16 ) ;
    else if ( ARG16 > ARG15 -> MEMBER00 ) ARG15 -> MEMBER03 = FUNC11 ( ARG15 -> MEMBER03 , ARG16 ) ;
    else if ( ARG15 -> MEMBER02 && ARG15 -> MEMBER03 ) {
        if ( ARG15 -> MEMBER02 -> MEMBER01 > ARG15 -> MEMBER03 -> MEMBER01 ) ARG15 = FUNC05 ( ARG15 ) ;
        else ARG15 = FUNC06 ( ARG15 ) ;
        ARG15 = FUNC11 ( ARG15 , ARG16 ) ;
    } else {
        STRUCT00 * VAR08 = ARG15 ;
        if ( ARG15 -> MEMBER02 ) {
            ARG15 = FUNC05 ( ARG15 ) ;
            ARG15 -> MEMBER03 = FUNC11 ( ARG15 -> MEMBER03 , ARG16 ) ;
        }
        else if ( ARG15 -> MEMBER03 ) {
            ARG15 = FUNC06 ( ARG15 ) ;
            ARG15 -> MEMBER02 = FUNC11 ( ARG15 -> MEMBER02 , ARG16 ) ;
        }
        else {
            ARG15 = NULL ;
            free ( VAR08 ) ;
        }
    }
    return ARG15 ;
}
void FUNC12 ( STRUCT01 * ARG17 , int ARG18 ) {
    ARG17 -> MEMBER04 = FUNC11 ( ARG17 -> MEMBER04 , ARG18 ) ;
    ARG17 -> MEMBER05 -- ;
}
void FUNC13 ( STRUCT00 * ARG19 ) {
    if ( ARG19 == NULL ) return ;
    FUNC13 ( ARG19 -> MEMBER02 ) ;
    putchar_unlocked ( ' ' ) , FUNC02 ( ARG19 -> MEMBER00 ) ;
    FUNC13 ( ARG19 -> MEMBER03 ) ;
}
void FUNC14 ( STRUCT00 * ARG20 ) {
    if ( ARG20 == NULL ) return ;
    putchar_unlocked ( ' ' ) , FUNC02 ( ARG20 -> MEMBER00 ) ;
    FUNC14 ( ARG20 -> MEMBER02 ) ;
    FUNC14 ( ARG20 -> MEMBER03 ) ;
}
int main ( int ARG21 , char * * ARG22 ) {
    STRUCT01 VAR09 ;
    FUNC04 ( & VAR09 ) ;
    int VAR10 = FUNC00 ( ) ;
    int VAR11 , VAR12 ;
    char VAR13 [ 8 ] ;
    for ( int VAR14 = 0 ; VAR14 < VAR10 ; ++ VAR14 ) {
        FUNC01 ( VAR13 ) ;
        switch ( * VAR13 ) {
        case 'i' :
            VAR11 = FUNC00 ( ) ;
            VAR12 = FUNC00 ( ) ;
            FUNC08 ( & VAR09 , VAR11 , VAR12 ) ;
            break ;
        case 'f' :
            VAR11 = FUNC00 ( ) ;
            FUNC03 ( FUNC09 ( VAR09 . MEMBER04 , VAR11 ) ? "yes\n" : "no\n" ) ;
            break ;
        case 'd' :
            VAR11 = FUNC00 ( ) ;
            FUNC12 ( & VAR09 , VAR11 ) ;
            break ;
        default :
            FUNC13 ( VAR09 . MEMBER04 ) ;
            putchar_unlocked ( '\n' ) ;
            FUNC14 ( VAR09 . MEMBER04 ) ;
            putchar_unlocked ( '\n' ) ;
            break ;
        }
    }
    return 0 ;
}


Measured memory_bytes: 7924