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

class B:
    def __init__(self, txt: str):
        self.s: E = None
        self.r: E = None
        self.o: E = None
        self.t: D = None
        self.v: F = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.q: B = None
        self.v: D = None
        self.s: A = None
        self.t: D = None
        self.txt = txt

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

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

g.q = d
g.x = h
g.u = b
m.s = h
m.r = h
m.o = h
m.t = d
m.v = b
j.r = h
j.u = m
d.z = m
d.w = k
h.v = k
h.u = m
h.p = d
h.z = g
h.q = g
h.r = j
b.q = m
b.v = d
b.t = d
b.s = g
k.v = g
k.p = g
k.q = b
k.w = b
assert g.q.w.w.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.x: E = None
        self.u: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: E = None
        self.r: E = None
        self.o: E = None
        self.t: D = None
        self.v: F = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.q: B = None
        self.v: D = None
        self.s: A = None
        self.t: D = None
        self.txt = txt

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

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

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