class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.v: A = None
        self.p: D = None
        self.t: B = None
        self.x: A = None
        self.w: B = None
        self.txt = txt

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

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

h = A("h")
i = B("i")
g = C("g")
a = D("a")
m = E("m")
k = B("k")

h.y = a
i.y = g
i.z = a
i.r = a
i.u = k
g.v = h
g.x = h
g.p = a
g.t = i
g.w = i
a.p = m
a.u = m
a.o = m
a.t = g
m.y = a
m.s = a
m.q = k
m.p = h
k.y = g
k.z = a
k.r = a
k.u = i
assert h.y.p.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.v: A = None
        self.p: D = None
        self.t: B = None
        self.x: A = None
        self.w: B = None
        self.txt = txt

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

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

h = A("h")
i = B("i")
g = C("g")
a = D("a")
m = E("m")
k = B("k")

h.y = a
i.y = g
i.z = a
i.r = a
i.u = k
g.v = h
g.x = h
g.p = a
g.t = i
g.w = i
a.p = m
a.u = m
a.o = m
a.t = g
m.y = a
m.s = a
m.q = k
m.p = h
k.y = g
k.z = a
k.r = a
k.u = i
assert h.y.p.y.txt == "a"