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

class B:
    def __init__(self, txt: str):
        self.s: A = None
        self.t: F = None
        self.z: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.w: F = None
        self.x: B = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.p: C = None
        self.s: C = None
        self.w: B = None
        self.v: C = None
        self.z: E = None
        self.txt = txt

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

m.x = b
m.p = b
m.s = b
m.z = f
g.s = m
g.t = j
g.z = b
b.t = a
b.s = j
c.w = j
c.x = g
a.w = c
a.q = f
j.p = b
j.s = b
j.v = b
j.w = g
j.z = a
f.w = j
f.x = g
assert j.p.t.w.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.z: D = None
        self.p: C = None
        self.s: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: A = None
        self.t: F = None
        self.z: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.w: F = None
        self.x: B = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.p: C = None
        self.s: C = None
        self.w: B = None
        self.v: C = None
        self.z: E = None
        self.txt = txt

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

m.x = b
m.p = b
m.s = b
m.z = f
g.s = m
g.t = j
g.z = b
b.t = a
b.s = j
c.w = j
c.x = g
a.w = c
a.q = f
j.p = b
j.s = b
j.v = b
j.w = g
j.z = a
f.w = j
f.x = g
assert j.p.t.w.txt == "c"