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

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

class C:
    def __init__(self, txt: str):
        self.v: E = None
        self.z: E = None
        self.r: B = None
        self.x: 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.x: B = None
        self.q: D = None
        self.p: B = None
        self.txt = txt

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

e.z = b
e.s = h
g.x = e
g.t = h
g.p = a
h.v = a
h.z = a
h.r = g
h.x = g
b.w = h
a.x = g
a.p = g
a.q = b
m.w = h
assert g.p.q.w.v.q.w.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.s: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.v: E = None
        self.z: E = None
        self.r: B = None
        self.x: 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.x: B = None
        self.q: D = None
        self.p: B = None
        self.txt = txt

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

e.z = b
e.s = h
g.x = e
g.t = h
g.p = a
h.v = a
h.z = a
h.r = g
h.x = g
b.w = h
a.x = g
a.p = g
a.q = b
m.w = h
assert g.p.q.w.v.q.w.txt == "h"