# coding: utf-8
import serial

ser = serial.Serial(4, 9600, timeout=1)
print ser.portstr
c = "\0"

# MAIN LOOP
while True:
    c = raw_input()
    ser.write(c)
    if(c == 'q'):
        break;

ser.close()