class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.v: G = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.z: G = None
        self.y: H = None
        self.o: F = None
        self.r: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.v: G = None
        self.z: D = None
        self.x: D = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.v: F = None
        self.o: H = None
        self.u: C = None
        self.t: H = None
        self.x: F = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.o: D = None
        self.y: F = None
        self.r: D = None
        self.q: G = None
        self.txt = txt

m = A("m")
b = B("b")
c = C("c")
f = D("f")
k = E("k")
h = F("h")
i = G("i")
g = H("g")
l = C("l")

m.x = c
b.u = m
c.v = i
f.z = i
f.y = g
f.o = h
f.r = h
k.v = i
k.z = f
k.x = f
h.z = m
i.v = h
i.x = h
i.o = g
i.t = g
i.u = l
g.o = f
g.r = f
g.y = h
g.q = i
l.v = i
assert f.z.x.z.x.v.x.z.x.v.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.v: G = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.z: G = None
        self.y: H = None
        self.o: F = None
        self.r: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.v: G = None
        self.z: D = None
        self.x: D = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.v: F = None
        self.o: H = None
        self.u: C = None
        self.t: H = None
        self.x: F = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.o: D = None
        self.y: F = None
        self.r: D = None
        self.q: G = None
        self.txt = txt

m = A("m")
b = B("b")
c = C("c")
f = D("f")
k = E("k")
h = F("h")
i = G("i")
g = H("g")
l = C("l")

m.x = c
b.u = m
c.v = i
f.z = i
f.y = g
f.o = h
f.r = h
k.v = i
k.z = f
k.x = f
h.z = m
i.v = h
i.x = h
i.o = g
i.t = g
i.u = l
g.o = f
g.r = f
g.y = h
g.q = i
l.v = i
assert f.z.x.z.x.v.x.z.x.v.txt == "i"