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

class B:
    def __init__(self, txt: str):
        self.z: D = None
        self.o: A = None
        self.w: D = None
        self.txt = txt

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

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

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

g = A("g")
h = B("h")
j = C("j")
d = D("d")
n = E("n")
m = A("m")
k = C("k")
b = A("b")
e = B("e")

g.x = e
g.u = e
g.p = b
g.z = b
h.z = d
h.w = d
h.o = m
j.x = e
j.t = g
j.r = b
j.y = b
d.q = b
d.z = e
d.s = m
n.o = j
n.z = h
n.v = e
n.w = d
n.u = d
m.x = h
m.u = e
m.p = b
m.z = g
k.x = e
k.t = m
k.y = m
k.r = b
b.x = e
b.u = e
b.p = m
b.z = m
e.z = d
e.w = d
e.o = g
assert h.z.q.p.z.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.u: B = None
        self.p: A = None
        self.z: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: D = None
        self.o: A = None
        self.w: D = None
        self.txt = txt

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

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

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

g = A("g")
h = B("h")
j = C("j")
d = D("d")
n = E("n")
m = A("m")
k = C("k")
b = A("b")
e = B("e")

g.x = e
g.u = e
g.p = b
g.z = b
h.z = d
h.w = d
h.o = m
j.x = e
j.t = g
j.r = b
j.y = b
d.q = b
d.z = e
d.s = m
n.o = j
n.z = h
n.v = e
n.w = d
n.u = d
m.x = h
m.u = e
m.p = b
m.z = g
k.x = e
k.t = m
k.y = m
k.r = b
b.x = e
b.u = e
b.p = m
b.z = m
e.z = d
e.w = d
e.o = g
assert h.z.q.p.z.txt == "g"