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

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

class C:
    def __init__(self, txt: str):
        self.p: C = None
        self.y: C = None
        self.txt = txt

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

a = A("a")
e = B("e")
j = C("j")
h = D("h")
b = A("b")
d = C("d")
m = B("m")
g = D("g")
f = D("f")
i = B("i")

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

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

class C:
    def __init__(self, txt: str):
        self.p: C = None
        self.y: C = None
        self.txt = txt

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

a = A("a")
e = B("e")
j = C("j")
h = D("h")
b = A("b")
d = C("d")
m = B("m")
g = D("g")
f = D("f")
i = B("i")

a.u = g
a.o = e
e.r = m
j.p = d
j.y = d
h.s = g
h.z = a
h.p = m
b.u = f
b.o = i
d.p = j
d.y = j
m.r = i
g.s = h
g.z = a
g.p = e
f.s = g
f.z = b
f.p = e
i.r = m
assert e.r.r.r.r.r.r.r.r.r.r.txt == "i"