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

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

class C:
    def __init__(self, txt: str):
        self.s: G = None
        self.x: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.r: B = None
        self.w: G = None
        self.q: F = None
        self.z: G = None
        self.x: B = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.p: H = None
        self.u: H = None
        self.o: H = None
        self.txt = txt

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.s: G = None
        self.x: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.r: B = None
        self.w: G = None
        self.q: F = None
        self.z: G = None
        self.x: B = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.p: H = None
        self.u: H = None
        self.o: H = None
        self.txt = txt

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

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

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

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