class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.y: C = None
        self.v: E = None
        self.p: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.y: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: F = None
        self.z: A = None
        self.r: D = None
        self.s: D = None
        self.txt = txt

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

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

m.s = g
m.y = f
m.v = n
m.p = h
g.y = f
f.x = g
f.v = n
f.o = h
f.y = h
i.y = n
n.o = h
n.z = m
n.r = i
n.s = i
h.p = f
h.z = n
a.y = n
assert a.y.o.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.y: C = None
        self.v: E = None
        self.p: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.y: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: F = None
        self.z: A = None
        self.r: D = None
        self.s: D = None
        self.txt = txt

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

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

m.s = g
m.y = f
m.v = n
m.p = h
g.y = f
f.x = g
f.v = n
f.o = h
f.y = h
i.y = n
n.o = h
n.z = m
n.r = i
n.s = i
h.p = f
h.z = n
a.y = n
assert a.y.o.z.z.txt == "m"