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

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: C = None
        self.p: E = None
        self.s: E = None
        self.v: C = None
        self.txt = txt

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: C = None
        self.p: E = None
        self.s: E = None
        self.v: C = None
        self.txt = txt

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

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