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

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

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

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

class E:
    def __init__(self, txt: str):
        self.r: A = None
        self.o: B = None
        self.v: C = None
        self.u: C = None
        self.s: D = None
        self.txt = txt

h = A("h")
e = B("e")
g = C("g")
c = D("c")
a = E("a")

h.y = e
e.q = a
e.t = a
e.x = a
e.p = a
e.u = c
g.y = c
g.w = c
g.x = h
g.r = e
g.t = e
c.w = g
a.r = h
a.o = e
a.v = g
a.u = g
a.s = c
assert c.w.w.w.x.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.r: A = None
        self.o: B = None
        self.v: C = None
        self.u: C = None
        self.s: D = None
        self.txt = txt

h = A("h")
e = B("e")
g = C("g")
c = D("c")
a = E("a")

h.y = e
e.q = a
e.t = a
e.x = a
e.p = a
e.u = c
g.y = c
g.w = c
g.x = h
g.r = e
g.t = e
c.w = g
a.r = h
a.o = e
a.v = g
a.u = g
a.s = c
assert c.w.w.w.x.y.txt == "e"