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

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

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

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

class E:
    def __init__(self, txt: str):
        self.t: C = None
        self.z: D = None
        self.x: D = None
        self.txt = txt

c = A("c")
d = B("d")
i = C("i")
f = D("f")
h = E("h")
j = D("j")
a = E("a")
n = A("n")

c.x = d
c.o = d
c.q = j
c.z = i
d.z = i
d.t = h
d.o = n
i.r = h
f.p = i
h.t = i
h.z = f
h.x = j
j.p = i
a.t = i
a.z = f
a.x = j
n.x = d
n.o = d
n.q = j
n.z = i
assert h.z.p.r.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.q: D = None
        self.o: B = None
        self.z: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.t: C = None
        self.z: D = None
        self.x: D = None
        self.txt = txt

c = A("c")
d = B("d")
i = C("i")
f = D("f")
h = E("h")
j = D("j")
a = E("a")
n = A("n")

c.x = d
c.o = d
c.q = j
c.z = i
d.z = i
d.t = h
d.o = n
i.r = h
f.p = i
h.t = i
h.z = f
h.x = j
j.p = i
a.t = i
a.z = f
a.x = j
n.x = d
n.o = d
n.q = j
n.z = i
assert h.z.p.r.txt == "h"