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

class B:
    def __init__(self, txt: str):
        self.p: E = None
        self.x: G = None
        self.v: D = None
        self.q: C = None
        self.txt = txt

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.z: D = None
        self.s: D = None
        self.w: C = None
        self.txt = txt

g = A("g")
m = B("m")
e = C("e")
d = D("d")
h = E("h")
a = F("a")
k = G("k")

g.w = k
g.q = m
m.p = h
m.x = k
m.v = d
m.q = e
e.s = h
e.y = h
e.p = h
d.q = h
h.s = k
a.z = k
a.y = g
a.s = g
a.w = d
k.z = d
k.s = d
k.w = e
assert k.w.p.s.w.y.txt == "
class A:
    def __init__(self, txt: str):
        self.w: G = None
        self.q: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: E = None
        self.x: G = None
        self.v: D = None
        self.q: C = None
        self.txt = txt

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.z: D = None
        self.s: D = None
        self.w: C = None
        self.txt = txt

g = A("g")
m = B("m")
e = C("e")
d = D("d")
h = E("h")
a = F("a")
k = G("k")

g.w = k
g.q = m
m.p = h
m.x = k
m.v = d
m.q = e
e.s = h
e.y = h
e.p = h
d.q = h
h.s = k
a.z = k
a.y = g
a.s = g
a.w = d
k.z = d
k.s = d
k.w = e
assert k.w.p.s.w.y.txt == "h"