def play_song(instrument, duration):
    """
    This function takes in an instrument and duration and plays a song using nested ternary operators.
    """

    # Check if the instrument is a guitar or piano
    if instrument == 'guitar':
        # Check the duration
        if duration <= 1:
            print("Playing a short guitar riff!")
        elif duration > 1 and duration <= 5:
            print("Playing a guitar melody!")
        else:
            print("Playing an epic guitar solo!")
    elif instrument == 'piano':
        # Check the duration
        if duration <= 1:
            print("Playing a short piano phrase!")
        elif duration > 1 and duration <= 5:
            print("Playing a piano composition!")
        else:
            print("Playing a grand piano concerto!")
    else:
        print("Invalid instrument!")

play_song('piano', 2)