from machine import Pin
b1= Pin(35, Pin.IN)
b2= Pin(34, Pin.IN)
n1= Pin(39, Pin.IN)
n2= Pin(36, Pin.IN)
m1= Pin(32, Pin.OUT)
m2= Pin(33, Pin.OUT)
while True:
m1.value(n1.value() and not b1.value())
m2.value( (not b1.value() and n2.value()) and ( not n1.value() or not b2.value()) )