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

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: F = None
        self.t: B = None
        self.r: D = None
        self.x: B = None
        self.y: A = None
        self.txt = txt

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

m = A("m")
d = B("d")
a = C("a")
f = D("f")
b = E("b")
c = F("c")

m.q = a
m.x = c
m.r = b
m.v = b
d.y = f
a.w = m
a.q = m
a.s = m
a.t = f
f.s = c
f.y = a
f.q = b
b.u = c
b.t = d
b.x = d
b.r = f
b.y = m
c.s = b
c.q = d
assert b.r.s.s.t.y.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.x: F = None
        self.r: E = None
        self.v: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: F = None
        self.t: B = None
        self.r: D = None
        self.x: B = None
        self.y: A = None
        self.txt = txt

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

m = A("m")
d = B("d")
a = C("a")
f = D("f")
b = E("b")
c = F("c")

m.q = a
m.x = c
m.r = b
m.v = b
d.y = f
a.w = m
a.q = m
a.s = m
a.t = f
f.s = c
f.y = a
f.q = b
b.u = c
b.t = d
b.x = d
b.r = f
b.y = m
c.s = b
c.q = d
assert b.r.s.s.t.y.q.txt == "b"