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

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

f = A("f")
i = B("i")
n = A("n")
e = B("e")
k = A("k")

f.z = k
i.o = k
n.z = k
e.o = n
k.z = n
assert i.o.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: A = None
        self.txt = txt

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

f = A("f")
i = B("i")
n = A("n")
e = B("e")
k = A("k")

f.z = k
i.o = k
n.z = k
e.o = n
k.z = n
assert i.o.z.z.txt == "k"