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

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

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

class D:
    def __init__(self, txt: str):
        self.x: B = None
        self.r: C = None
        self.u: E = None
        self.p: E = None
        self.txt = txt

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.x: B = None
        self.r: C = None
        self.u: E = None
        self.p: E = None
        self.txt = txt

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

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

h.x = d
h.z = d
h.s = b
b.w = h
b.z = h
b.r = n
b.u = e
b.p = d
n.q = l
e.x = b
e.r = n
e.u = d
e.p = d
d.t = n
d.v = c
c.x = d
c.z = d
c.s = b
l.x = b
l.r = n
l.u = d
l.p = d
assert d.v.s.u.x.u.r.q.txt == "l"