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

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

class C:
    def __init__(self, txt: str):
        self.w: I = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.u: I = None
        self.txt = txt

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

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

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

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

class I:
    def __init__(self, txt: str):
        self.s: C = None
        self.q: E = None
        self.x: F = None
        self.y: C = None
        self.r: B = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.w: I = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.u: I = None
        self.txt = txt

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

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

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

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

class I:
    def __init__(self, txt: str):
        self.s: C = None
        self.q: E = None
        self.x: F = None
        self.y: C = None
        self.r: B = None
        self.txt = txt

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

g.s = k
k.q = f
k.y = f
k.z = e
k.r = e
k.w = i
k.x = m
k.u = m
k.s = m
j.w = d
n.u = d
m.s = k
m.v = f
f.r = g
e.z = k
e.y = k
i.q = g
d.s = j
d.y = j
d.q = m
d.x = f
d.r = k
assert n.u.x.r.s.x.v.txt == "f"