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

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

class C:
    def __init__(self, txt: str):
        self.v: B = None
        self.z: B = 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.s: C = None
        self.o: D = None
        self.x: B = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.v: B = None
        self.z: B = 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.s: C = None
        self.o: D = None
        self.x: B = None
        self.txt = txt

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

f.x = g
f.s = g
f.u = n
f.z = n
g.p = f
g.o = f
g.z = c
g.t = i
n.v = g
n.z = g
c.p = n
i.s = n
i.o = c
i.x = g
a.s = n
a.o = c
a.x = g
m.s = n
m.o = c
m.x = g
assert g.o.u.v.txt == "g"