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

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

class C:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

k = A("k")
e = B("e")
l = C("l")
b = B("b")
i = B("i")
f = A("f")
c = A("c")

k.r = f
k.z = l
k.o = b
e.w = f
l.t = b
b.w = f
i.w = f
f.r = k
f.z = l
f.o = b
c.r = k
c.z = l
c.o = b
assert c.z.t.w.r.z.t.w.txt == "
class A:
    def __init__(self, txt: str):
        self.r: A = None
        self.z: C = None
        self.o: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

k = A("k")
e = B("e")
l = C("l")
b = B("b")
i = B("i")
f = A("f")
c = A("c")

k.r = f
k.z = l
k.o = b
e.w = f
l.t = b
b.w = f
i.w = f
f.r = k
f.z = l
f.o = b
c.r = k
c.z = l
c.o = b
assert c.z.t.w.r.z.t.w.txt == "f"