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

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

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

j.z = f
j.u = f
f.s = k
i.s = j
e.s = k
k.z = i
k.u = i
assert i.s.u.s.z.s.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.u: B = None
        self.txt = txt

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

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

j.z = f
j.u = f
f.s = k
i.s = j
e.s = k
k.z = i
k.u = i
assert i.s.u.s.z.s.txt == "j"