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

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

class C:
    def __init__(self, txt: str):
        self.z: A = None
        self.s: A = None
        self.u: F = None
        self.v: A = None
        self.p: F = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.r: B = None
        self.q: G = None
        self.v: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.x: D = None
        self.o: D = None
        self.u: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.y: E = None
        self.p: A = None
        self.w: C = None
        self.u: D = None
        self.txt = txt

d = A("d")
i = B("i")
n = C("n")
e = D("e")
f = E("f")
g = F("g")
k = G("k")
h = D("h")
b = G("b")

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

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

class C:
    def __init__(self, txt: str):
        self.z: A = None
        self.s: A = None
        self.u: F = None
        self.v: A = None
        self.p: F = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.r: B = None
        self.q: G = None
        self.v: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.x: D = None
        self.o: D = None
        self.u: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.y: E = None
        self.p: A = None
        self.w: C = None
        self.u: D = None
        self.txt = txt

d = A("d")
i = B("i")
n = C("n")
e = D("e")
f = E("f")
g = F("g")
k = G("k")
h = D("h")
b = G("b")

d.q = i
i.r = n
i.q = e
n.z = d
n.s = d
n.v = d
n.u = g
n.p = g
e.o = b
e.w = d
f.r = i
f.q = b
f.v = b
g.x = e
g.o = h
g.u = b
k.y = f
k.p = d
k.w = n
k.u = h
h.o = b
h.w = d
b.y = f
b.p = d
b.w = n
b.u = e
assert h.w.q.q.w.q.q.w.q.txt == "i"