class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.r: D = None
        self.y: G = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.o: E = None
        self.z: C = None
        self.y: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: B = None
        self.p: C = None
        self.w: D = None
        self.t: G = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.x: A = None
        self.v: D = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.s: C = None
        self.txt = txt

d = A("d")
e = B("e")
a = C("a")
m = D("m")
h = E("h")
c = F("c")
f = G("f")
j = H("j")

d.s = a
d.r = m
d.y = f
e.x = h
e.r = j
e.s = a
a.r = c
a.q = j
m.o = h
m.z = a
m.y = c
h.q = e
h.p = a
h.w = m
h.t = f
c.u = j
c.o = e
c.v = f
f.x = d
f.v = m
j.s = a
assert d.y.x.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.r: D = None
        self.y: G = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.o: E = None
        self.z: C = None
        self.y: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: B = None
        self.p: C = None
        self.w: D = None
        self.t: G = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.x: A = None
        self.v: D = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.s: C = None
        self.txt = txt

d = A("d")
e = B("e")
a = C("a")
m = D("m")
h = E("h")
c = F("c")
f = G("f")
j = H("j")

d.s = a
d.r = m
d.y = f
e.x = h
e.r = j
e.s = a
a.r = c
a.q = j
m.o = h
m.z = a
m.y = c
h.q = e
h.p = a
h.w = m
h.t = f
c.u = j
c.o = e
c.v = f
f.x = d
f.v = m
j.s = a
assert d.y.x.s.txt == "a"