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

class B:
    def __init__(self, txt: str):
        self.s: F = None
        self.t: C = None
        self.p: F = None
        self.q: D = None
        self.txt = txt

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

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

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

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

a = A("a")
m = B("m")
k = C("k")
c = D("c")
n = E("n")
e = F("e")
g = F("g")
b = F("b")

a.z = k
m.s = b
m.p = b
m.t = k
m.q = c
k.t = m
k.v = c
c.z = m
n.s = k
n.p = a
e.v = k
e.q = k
g.v = k
g.q = k
b.v = k
b.q = k
assert a.z.v.z.t.t.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: F = None
        self.t: C = None
        self.p: F = None
        self.q: D = None
        self.txt = txt

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

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

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

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

a = A("a")
m = B("m")
k = C("k")
c = D("c")
n = E("n")
e = F("e")
g = F("g")
b = F("b")

a.z = k
m.s = b
m.p = b
m.t = k
m.q = c
k.t = m
k.v = c
c.z = m
n.s = k
n.p = a
e.v = k
e.q = k
g.v = k
g.q = k
b.v = k
b.q = k
assert a.z.v.z.t.t.t.t.txt == "m"