class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.z: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: A = None
        self.s: A = None
        self.txt = txt

i = A("i")
l = B("l")
f = A("f")
b = A("b")
k = B("k")

i.o = l
i.z = k
l.o = i
l.s = i
f.o = l
f.z = k
b.o = l
b.z = k
k.o = i
k.s = i
assert b.o.o.z.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.z: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: A = None
        self.s: A = None
        self.txt = txt

i = A("i")
l = B("l")
f = A("f")
b = A("b")
k = B("k")

i.o = l
i.z = k
l.o = i
l.s = i
f.o = l
f.z = k
b.o = l
b.z = k
k.o = i
k.s = i
assert b.o.o.z.o.o.txt == "l"