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

class B:
    def __init__(self, txt: str):
        self.o: E = None
        self.v: C = None
        self.x: E = None
        self.txt = txt

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.o: E = None
        self.v: C = None
        self.x: E = None
        self.txt = txt

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

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

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

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

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