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

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

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

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

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

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

h.o = a
f.x = m
f.t = a
f.z = d
a.p = m
a.z = d
a.q = h
n.w = j
n.u = j
n.q = f
n.z = f
d.z = n
d.p = m
d.q = i
j.x = m
j.t = a
j.z = d
g.o = a
i.p = m
i.z = d
i.q = g
m.w = j
m.q = j
m.u = j
m.z = f
assert h.o.q.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.txt = txt

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

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

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

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

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

h.o = a
f.x = m
f.t = a
f.z = d
a.p = m
a.z = d
a.q = h
n.w = j
n.u = j
n.q = f
n.z = f
d.z = n
d.p = m
d.q = i
j.x = m
j.t = a
j.z = d
g.o = a
i.p = m
i.z = d
i.q = g
m.w = j
m.q = j
m.u = j
m.z = f
assert h.o.q.o.txt == "a"