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

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

class C:
    def __init__(self, txt: str):
        self.z: C = None
        self.o: C = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.o: A = None
        self.z: A = None
        self.w: B = None
        self.v: B = None
        self.y: C = None
        self.txt = txt

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

d.y = i
d.w = i
d.p = h
d.q = n
d.u = a
h.x = d
h.p = i
c.z = a
c.o = a
n.v = d
n.t = i
n.o = l
i.o = d
i.z = d
i.w = h
i.v = h
i.y = c
l.x = d
l.p = i
a.z = c
a.o = c
assert h.x.w.z.p.p.y.o.txt == "
class A:
    def __init__(self, txt: str):
        self.y: E = None
        self.p: B = None
        self.q: D = None
        self.u: C = None
        self.w: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.z: C = None
        self.o: C = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.o: A = None
        self.z: A = None
        self.w: B = None
        self.v: B = None
        self.y: C = None
        self.txt = txt

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

d.y = i
d.w = i
d.p = h
d.q = n
d.u = a
h.x = d
h.p = i
c.z = a
c.o = a
n.v = d
n.t = i
n.o = l
i.o = d
i.z = d
i.w = h
i.v = h
i.y = c
l.x = d
l.p = i
a.z = c
a.o = c
assert h.x.w.z.p.p.y.o.txt == "a"