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

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

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

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

class E:
    def __init__(self, txt: str):
        self.o: A = None
        self.p: I = None
        self.v: H = None
        self.u: C = None
        self.z: C = None
        self.r: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.z: E = None
        self.p: E = None
        self.y: D = None
        self.s: C = None
        self.r: I = None
        self.w: H = None
        self.txt = txt

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

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

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

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.o: A = None
        self.p: I = None
        self.v: H = None
        self.u: C = None
        self.z: C = None
        self.r: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.z: E = None
        self.p: E = None
        self.y: D = None
        self.s: C = None
        self.r: I = None
        self.w: H = None
        self.txt = txt

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

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

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

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

f.r = d
d.u = j
m.z = k
m.q = b
j.s = b
j.v = d
b.o = f
b.p = g
b.v = e
b.u = m
b.z = m
b.r = d
k.z = b
k.p = b
k.y = j
k.s = m
k.r = g
k.w = e
l.u = d
l.s = f
l.t = m
l.q = g
l.o = j
e.q = d
e.v = m
g.w = l
assert k.s.q.r.u.v.u.s.v.v.txt == "m"