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

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

class C:
    def __init__(self, txt: str):
        self.q: G = None
        self.r: D = None
        self.s: A = None
        self.z: F = None
        self.txt = txt

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

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

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

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

c = A("c")
e = B("e")
f = C("f")
d = D("d")
m = E("m")
i = F("i")
a = G("a")

c.q = i
c.y = d
c.r = m
e.p = m
e.w = f
f.q = a
f.r = d
f.s = c
f.z = i
d.w = a
d.x = c
m.x = f
m.p = e
m.t = i
i.v = f
i.p = d
i.s = c
i.z = e
a.v = f
a.t = f
assert c.q.z.w.txt == "
class A:
    def __init__(self, txt: str):
        self.q: F = None
        self.y: D = None
        self.r: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.q: G = None
        self.r: D = None
        self.s: A = None
        self.z: F = None
        self.txt = txt

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

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

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

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

c = A("c")
e = B("e")
f = C("f")
d = D("d")
m = E("m")
i = F("i")
a = G("a")

c.q = i
c.y = d
c.r = m
e.p = m
e.w = f
f.q = a
f.r = d
f.s = c
f.z = i
d.w = a
d.x = c
m.x = f
m.p = e
m.t = i
i.v = f
i.p = d
i.s = c
i.z = e
a.v = f
a.t = f
assert c.q.z.w.txt == "f"