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

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

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

class D:
    def __init__(self, txt: str):
        self.o: C = None
        self.txt = txt

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

i = A("i")
a = B("a")
c = C("c")
f = D("f")
j = E("j")
h = E("h")

i.r = f
i.u = a
i.t = h
a.o = f
c.y = i
c.x = a
f.o = c
j.t = h
j.u = a
h.t = j
h.u = a
assert h.u.o.o.x.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.u: B = None
        self.t: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.o: C = None
        self.txt = txt

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

i = A("i")
a = B("a")
c = C("c")
f = D("f")
j = E("j")
h = E("h")

i.r = f
i.u = a
i.t = h
a.o = f
c.y = i
c.x = a
f.o = c
j.t = h
j.u = a
h.t = j
h.u = a
assert h.u.o.o.x.o.o.txt == "c"