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

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

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

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

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

e = A("e")
j = B("j")
l = C("l")
d = D("d")
n = E("n")
h = D("h")

e.r = n
j.w = n
j.z = d
l.u = d
l.t = n
d.x = e
d.r = h
d.u = h
d.z = n
d.v = l
n.q = j
n.t = j
n.o = h
h.x = e
h.r = d
h.u = d
h.z = n
h.v = l
assert h.v.u.z.t.z.txt == "
class A:
    def __init__(self, txt: str):
        self.r: E = None
        self.txt = txt

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

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

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

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

e = A("e")
j = B("j")
l = C("l")
d = D("d")
n = E("n")
h = D("h")

e.r = n
j.w = n
j.z = d
l.u = d
l.t = n
d.x = e
d.r = h
d.u = h
d.z = n
d.v = l
n.q = j
n.t = j
n.o = h
h.x = e
h.r = d
h.u = d
h.z = n
h.v = l
assert h.v.u.z.t.z.txt == "d"