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

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

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

class D:
    def __init__(self, txt: str):
        self.t: F = None
        self.r: B = None
        self.z: F = None
        self.y: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.w: F = None
        self.u: G = None
        self.s: B = None
        self.q: H = None
        self.v: C = None
        self.txt = txt

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

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

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.t: F = None
        self.r: B = None
        self.z: F = None
        self.y: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.w: F = None
        self.u: G = None
        self.s: B = None
        self.q: H = None
        self.v: C = None
        self.txt = txt

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

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

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

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

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