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

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

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

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

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

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

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

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

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

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

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

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

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

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

m.s = l
j.z = m
j.y = l
j.r = c
f.s = n
f.x = n
f.w = c
l.v = f
l.t = f
c.u = j
c.z = j
c.r = f
c.q = m
n.v = f
assert c.q.s.t.w.q.txt == "m"