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

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

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

class D:
    def __init__(self, txt: str):
        self.v: C = None
        self.r: B = None
        self.txt = txt

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.v: C = None
        self.r: B = None
        self.txt = txt

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

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

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