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

class B:
    def __init__(self, txt: str):
        self.y: G = None
        self.z: H = None
        self.t: E = None
        self.r: H = None
        self.u: F = None
        self.s: G = None
        self.x: G = None
        self.txt = txt

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

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

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

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.y: G = None
        self.z: H = None
        self.t: E = None
        self.r: H = None
        self.u: F = None
        self.s: G = None
        self.x: G = None
        self.txt = txt

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

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

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

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

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

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

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

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