class A:
    def __init__(self, txt: str):
        self.w: G = None
        self.u: H = None
        self.s: E = None
        self.q: E = None
        self.r: H = None
        self.x: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: F = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.r: F = None
        self.t: B = None
        self.w: A = None
        self.u: I = None
        self.v: A = None
        self.p: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.w: I = None
        self.s: B = None
        self.x: I = None
        self.t: C = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.r: B = None
        self.x: F = None
        self.txt = txt

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

d = A("d")
l = B("l")
m = C("m")
n = D("n")
c = E("c")
g = F("g")
i = G("i")
h = H("h")
k = I("k")

d.w = i
d.u = h
d.r = h
d.s = c
d.q = c
d.x = c
l.s = g
m.w = g
n.w = h
n.q = i
c.r = g
c.t = l
c.w = d
c.v = d
c.p = d
c.u = k
g.w = k
g.x = k
g.s = l
g.t = m
i.z = m
h.r = l
h.x = g
k.t = c
k.q = c
assert k.t.t.s.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: G = None
        self.u: H = None
        self.s: E = None
        self.q: E = None
        self.r: H = None
        self.x: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: F = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.r: F = None
        self.t: B = None
        self.w: A = None
        self.u: I = None
        self.v: A = None
        self.p: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.w: I = None
        self.s: B = None
        self.x: I = None
        self.t: C = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.r: B = None
        self.x: F = None
        self.txt = txt

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

d = A("d")
l = B("l")
m = C("m")
n = D("n")
c = E("c")
g = F("g")
i = G("i")
h = H("h")
k = I("k")

d.w = i
d.u = h
d.r = h
d.s = c
d.q = c
d.x = c
l.s = g
m.w = g
n.w = h
n.q = i
c.r = g
c.t = l
c.w = d
c.v = d
c.p = d
c.u = k
g.w = k
g.x = k
g.s = l
g.t = m
i.z = m
h.r = l
h.x = g
k.t = c
k.q = c
assert k.t.t.s.w.txt == "k"