#!/usr/bin/env python3
import pyvips
import numpy as np

format_to_dtype = {
    'uchar': np.uint8,
    'char': np.int8,
    'ushort': np.uint16,
    'short': np.int16,
    'uint': np.uint32,
    'int': np.int32,
    'float': np.float32,
    'double': np.float64,
    'complex': np.complex64,
    'dpcomplex': np.complex128,
}


def flutsend(img,ox,oy):

    np_3d = np.ndarray(buffer=img.write_to_memory(),
                   dtype=format_to_dtype[img.format],
                   shape=[img.height, img.width, img.bands])


    for y, row in enumerate(np_3d):
        for x, pixel in enumerate(row):
            m=1
            if len(list(pixel)) == 1:
                m=0
            print(f"PX {x+ox} {y+oy} {pixel[0]:02x}{pixel[1*m]:02x}{pixel[2*m]:02x}")



def fluttext(text,x,y,width=1024):

    img = pyvips.Image.text(text,dpi=150,font='monospace',width=width)

    flutsend(img,x,y)

    return img.height

try:
    h=0
    while True:
        inp = input()
        if len(inp.strip()) < 1:
            h+=5
            continue
        h+=fluttext(inp,0,h)+1
        if h > 600:
            h=0

except EOFError:
    pass






