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

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

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

i = A("i")
b = B("b")
l = C("l")
f = A("f")
e = C("e")
j = B("j")
h = B("h")

i.o = b
i.r = f
i.u = f
b.w = i
b.z = h
l.x = f
f.o = h
f.r = i
f.u = i
e.x = f
j.w = f
j.z = b
h.w = i
h.z = j
assert e.x.u.r.o.z.w.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.r: A = None
        self.u: A = None
        self.txt = txt

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

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

i = A("i")
b = B("b")
l = C("l")
f = A("f")
e = C("e")
j = B("j")
h = B("h")

i.o = b
i.r = f
i.u = f
b.w = i
b.z = h
l.x = f
f.o = h
f.r = i
f.u = i
e.x = f
j.w = f
j.z = b
h.w = i
h.z = j
assert e.x.u.r.o.z.w.txt == "f"