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

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

class C:
    def __init__(self, txt: str):
        self.y: E = None
        self.v: B = None
        self.z: D = None
        self.p: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.z: B = None
        self.y: B = None
        self.t: B = None
        self.u: A = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.y: E = None
        self.v: B = None
        self.z: D = None
        self.p: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.z: B = None
        self.y: B = None
        self.t: B = None
        self.u: A = None
        self.txt = txt

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

d.t = e
l.q = d
l.r = e
e.y = m
e.p = m
e.v = h
e.z = n
n.u = m
n.x = m
n.w = d
m.z = l
m.y = l
m.t = h
m.u = d
h.q = d
h.r = e
assert e.y.z.r.p.t.r.txt == "e"