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

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.y: D = None
        self.r: C = None
        self.w: E = None
        self.v: E = None
        self.txt = txt

b = A("b")
f = B("f")
m = C("m")
c = D("c")
i = E("i")
n = F("n")

b.s = c
b.q = c
f.u = n
f.q = b
f.w = m
f.p = i
m.s = c
c.v = m
i.q = c
n.y = c
n.r = m
n.w = i
n.v = i
assert b.q.v.s.v.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.q: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.y: D = None
        self.r: C = None
        self.w: E = None
        self.v: E = None
        self.txt = txt

b = A("b")
f = B("f")
m = C("m")
c = D("c")
i = E("i")
n = F("n")

b.s = c
b.q = c
f.u = n
f.q = b
f.w = m
f.p = i
m.s = c
c.v = m
i.q = c
n.y = c
n.r = m
n.w = i
n.v = i
assert b.q.v.s.v.s.txt == "c"