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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.z: I = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.o: B = None
        self.s: C = None
        self.u: D = None
        self.x: C = None
        self.r: D = None
        self.q: A = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.x: D = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.y: E = None
        self.p: G = None
        self.q: B = None
        self.o: C = None
        self.txt = txt

f = A("f")
j = B("j")
k = C("k")
b = D("b")
a = E("a")
m = F("m")
i = G("i")
e = H("e")
g = I("g")

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.z: I = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.o: B = None
        self.s: C = None
        self.u: D = None
        self.x: C = None
        self.r: D = None
        self.q: A = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.x: D = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.y: E = None
        self.p: G = None
        self.q: B = None
        self.o: C = None
        self.txt = txt

f = A("f")
j = B("j")
k = C("k")
b = D("b")
a = E("a")
m = F("m")
i = G("i")
e = H("e")
g = I("g")

f.z = j
j.p = m
j.q = e
j.r = b
j.w = a
k.w = e
k.t = f
b.t = m
b.x = e
a.q = e
m.z = g
i.o = j
i.s = k
i.x = k
i.u = b
i.r = b
i.q = f
e.x = b
g.y = a
g.p = i
g.q = j
g.o = k
assert m.z.p.q.z.q.x.x.x.txt == "b"