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

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

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

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

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

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

n = A("n")
j = B("j")
m = C("m")
c = D("c")
g = E("g")
l = F("l")

n.v = m
n.s = l
n.q = c
j.t = l
j.u = l
j.p = l
j.z = m
j.q = n
j.x = g
m.x = c
c.z = j
c.q = j
c.v = m
g.o = c
g.x = c
g.s = j
g.t = j
g.q = m
l.r = j
l.y = g
l.s = m
assert m.x.v.x.v.x.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.s: F = None
        self.q: D = None
        self.txt = txt

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

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

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

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

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

n = A("n")
j = B("j")
m = C("m")
c = D("c")
g = E("g")
l = F("l")

n.v = m
n.s = l
n.q = c
j.t = l
j.u = l
j.p = l
j.z = m
j.q = n
j.x = g
m.x = c
c.z = j
c.q = j
c.v = m
g.o = c
g.x = c
g.s = j
g.t = j
g.q = m
l.r = j
l.y = g
l.s = m
assert m.x.v.x.v.x.v.txt == "m"