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

class B:
    def __init__(self, txt: str):
        self.w: G = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.z: G = None
        self.v: A = None
        self.w: A = None
        self.txt = txt

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

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

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

class B:
    def __init__(self, txt: str):
        self.w: G = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.z: G = None
        self.v: A = None
        self.w: A = None
        self.txt = txt

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

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

f.s = i
f.p = m
f.v = n
f.z = g
f.w = g
c.w = e
n.x = e
m.y = f
i.q = c
g.z = e
g.v = f
g.w = f
e.q = m
assert c.w.q.y.w.w.txt == "f"