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

class B:
    def __init__(self, txt: str):
        self.u: E = None
        self.v: H = None
        self.p: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.w: I = None
        self.x: H = None
        self.u: G = None
        self.v: H = None
        self.r: B = None
        self.t: A = None
        self.z: B = None
        self.s: B = None
        self.p: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: H = None
        self.v: I = None
        self.s: F = None
        self.z: F = None
        self.x: D = None
        self.q: D = None
        self.p: G = None
        self.w: B = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.z: G = None
        self.v: G = None
        self.w: B = None
        self.t: I = None
        self.y: I = None
        self.o: F = None
        self.s: B = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.x: F = None
        self.txt = txt

b = A("b")
g = B("g")
m = C("m")
j = D("j")
l = E("l")
i = F("i")
d = G("d")
f = H("f")
h = I("h")

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

class B:
    def __init__(self, txt: str):
        self.u: E = None
        self.v: H = None
        self.p: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.w: I = None
        self.x: H = None
        self.u: G = None
        self.v: H = None
        self.r: B = None
        self.t: A = None
        self.z: B = None
        self.s: B = None
        self.p: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: H = None
        self.v: I = None
        self.s: F = None
        self.z: F = None
        self.x: D = None
        self.q: D = None
        self.p: G = None
        self.w: B = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.z: G = None
        self.v: G = None
        self.w: B = None
        self.t: I = None
        self.y: I = None
        self.o: F = None
        self.s: B = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.x: F = None
        self.txt = txt

b = A("b")
g = B("g")
m = C("m")
j = D("j")
l = E("l")
i = F("i")
d = G("d")
f = H("f")
h = I("h")

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