class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.o: C = None
        self.t: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: F = None
        self.u: F = None
        self.t: F = None
        self.r: B = None
        self.v: C = None
        self.txt = txt

m = A("m")
a = B("a")
l = C("l")
n = D("n")
b = E("b")
i = F("i")
g = F("g")

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

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

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

class D:
    def __init__(self, txt: str):
        self.o: C = None
        self.t: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: F = None
        self.u: F = None
        self.t: F = None
        self.r: B = None
        self.v: C = None
        self.txt = txt

m = A("m")
a = B("a")
l = C("l")
n = D("n")
b = E("b")
i = F("i")
g = F("g")

m.v = a
a.z = l
l.q = a
l.v = n
l.x = n
n.o = l
n.t = i
b.p = m
i.p = g
i.u = g
i.t = g
i.r = a
i.v = l
g.p = i
g.u = i
g.t = i
g.r = a
g.v = l
assert m.v.z.q.txt == "a"