class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.y: F = None
        self.v: C = None
        self.z: C = None
        self.r: F = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.p: F = None
        self.x: B = None
        self.v: F = None
        self.z: A = None
        self.w: B = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.p: B = None
        self.w: E = None
        self.z: A = None
        self.q: B = None
        self.txt = txt

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.p: F = None
        self.x: B = None
        self.v: F = None
        self.z: A = None
        self.w: B = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.p: B = None
        self.w: E = None
        self.z: A = None
        self.q: B = None
        self.txt = txt

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

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