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

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

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

class D:
    def __init__(self, txt: str):
        self.w: A = None
        self.v: G = None
        self.x: E = None
        self.q: E = None
        self.o: G = None
        self.r: B = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.q: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.u: F = None
        self.x: E = None
        self.t: D = None
        self.q: B = None
        self.r: E = None
        self.p: B = None
        self.w: A = None
        self.txt = txt

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

h.w = m
h.v = d
h.t = f
k.u = h
k.z = h
k.y = f
k.v = f
k.p = d
k.s = m
k.t = e
m.p = h
d.w = h
d.v = f
d.o = f
d.x = j
d.q = j
d.r = k
j.v = h
j.p = e
j.z = k
e.q = m
f.u = e
f.x = j
f.r = j
f.t = d
f.q = k
f.p = k
f.w = h
assert h.t.u.q.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.v: D = None
        self.t: G = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.w: A = None
        self.v: G = None
        self.x: E = None
        self.q: E = None
        self.o: G = None
        self.r: B = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.q: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.u: F = None
        self.x: E = None
        self.t: D = None
        self.q: B = None
        self.r: E = None
        self.p: B = None
        self.w: A = None
        self.txt = txt

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

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