class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.txt = txt

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

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

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

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

g = A("g")
f = B("f")
d = C("d")
j = D("j")
n = E("n")
e = D("e")

g.y = e
f.u = d
f.t = d
d.q = g
d.o = f
d.p = e
d.r = j
d.u = j
j.s = e
j.z = e
j.y = n
n.x = d
e.s = j
e.z = j
e.y = n
assert n.x.u.s.y.x.p.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.txt = txt

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

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

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

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

g = A("g")
f = B("f")
d = C("d")
j = D("j")
n = E("n")
e = D("e")

g.y = e
f.u = d
f.t = d
d.q = g
d.o = f
d.p = e
d.r = j
d.u = j
j.s = e
j.z = e
j.y = n
n.x = d
e.s = j
e.z = j
e.y = n
assert n.x.u.s.y.x.p.txt == "e"