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

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

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

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

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

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

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

class H:
    def __init__(self, txt: str):
        self.q: B = None
        self.txt = txt

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

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

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

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

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

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

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

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

class H:
    def __init__(self, txt: str):
        self.q: B = None
        self.txt = txt

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

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