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

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

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

class D:
    def __init__(self, txt: str):
        self.w: B = None
        self.o: B = None
        self.s: A = None
        self.y: E = None
        self.x: B = None
        self.txt = txt

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

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

m.z = h
m.o = a
m.p = c
m.u = c
a.r = c
a.q = c
a.o = m
n.t = h
n.s = g
c.w = a
c.o = a
c.x = a
c.s = m
c.y = g
g.o = a
g.z = a
g.x = a
g.y = m
h.t = n
h.s = g
assert c.o.o.p.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.o: B = None
        self.p: D = None
        self.u: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.w: B = None
        self.o: B = None
        self.s: A = None
        self.y: E = None
        self.x: B = None
        self.txt = txt

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

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

m.z = h
m.o = a
m.p = c
m.u = c
a.r = c
a.q = c
a.o = m
n.t = h
n.s = g
c.w = a
c.o = a
c.x = a
c.s = m
c.y = g
g.o = a
g.z = a
g.x = a
g.y = m
h.t = n
h.s = g
assert c.o.o.p.txt == "c"