class A:
    def __init__(self, txt: str):
        self.q: F = None
        self.w: B = None
        self.v: C = None
        self.y: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.o: A = None
        self.y: G = None
        self.t: F = None
        self.w: D = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.o: D = None
        self.p: B = None
        self.txt = txt

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.o: A = None
        self.y: G = None
        self.t: F = None
        self.w: D = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.o: D = None
        self.p: B = None
        self.txt = txt

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

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

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

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