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

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

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

class D:
    def __init__(self, txt: str):
        self.w: C = None
        self.y: A = None
        self.t: E = None
        self.u: E = None
        self.x: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.z: D = None
        self.o: A = None
        self.p: A = None
        self.u: C = None
        self.txt = txt

c = A("c")
n = B("n")
a = C("a")
d = D("d")
f = E("f")
h = A("h")

c.x = d
c.r = f
n.u = d
a.s = d
a.z = d
a.o = f
a.y = f
d.w = a
d.y = c
d.x = c
d.t = f
d.u = f
f.z = d
f.o = h
f.p = c
f.u = a
h.x = d
h.r = f
assert h.x.w.s.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.r: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.w: C = None
        self.y: A = None
        self.t: E = None
        self.u: E = None
        self.x: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.z: D = None
        self.o: A = None
        self.p: A = None
        self.u: C = None
        self.txt = txt

c = A("c")
n = B("n")
a = C("a")
d = D("d")
f = E("f")
h = A("h")

c.x = d
c.r = f
n.u = d
a.s = d
a.z = d
a.o = f
a.y = f
d.w = a
d.y = c
d.x = c
d.t = f
d.u = f
f.z = d
f.o = h
f.p = c
f.u = a
h.x = d
h.r = f
assert h.x.w.s.x.x.txt == "d"