class A:
    def __init__(self, txt: str):
        self.y: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: G = None
        self.q: C = None
        self.z: D = None
        self.r: D = None
        self.v: D = None
        self.w: F = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.u: A = None
        self.y: C = None
        self.w: B = None
        self.o: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.q: E = None
        self.s: H = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.q: E = None
        self.v: A = None
        self.p: B = None
        self.t: D = None
        self.r: C = None
        self.o: A = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.s: G = None
        self.q: C = None
        self.z: D = None
        self.r: D = None
        self.v: D = None
        self.w: F = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.u: A = None
        self.y: C = None
        self.w: B = None
        self.o: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.q: E = None
        self.s: H = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.q: E = None
        self.v: A = None
        self.p: B = None
        self.t: D = None
        self.r: C = None
        self.o: A = None
        self.txt = txt

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

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