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

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

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

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

class E:
    def __init__(self, txt: str):
        self.z: F = None
        self.x: D = None
        self.y: F = None
        self.q: A = None
        self.w: B = None
        self.txt = txt

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

j = A("j")
m = B("m")
d = C("d")
e = D("e")
f = E("f")
g = F("g")

j.s = m
j.u = m
j.q = f
m.s = f
m.t = f
d.r = j
d.w = j
d.x = g
e.o = m
e.u = m
e.t = j
e.v = d
f.z = g
f.y = g
f.x = e
f.q = j
f.w = m
g.o = d
g.x = f
assert d.w.q.q.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.q: E = None
        self.u: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.z: F = None
        self.x: D = None
        self.y: F = None
        self.q: A = None
        self.w: B = None
        self.txt = txt

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

j = A("j")
m = B("m")
d = C("d")
e = D("e")
f = E("f")
g = F("g")

j.s = m
j.u = m
j.q = f
m.s = f
m.t = f
d.r = j
d.w = j
d.x = g
e.o = m
e.u = m
e.t = j
e.v = d
f.z = g
f.y = g
f.x = e
f.q = j
f.w = m
g.o = d
g.x = f
assert d.w.q.q.s.txt == "m"