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

class B:
    def __init__(self, txt: str):
        self.t: C = None
        self.u: A = None
        self.p: D = None
        self.w: D = None
        self.txt = txt

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

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

j = A("j")
d = B("d")
m = C("m")
f = D("f")
i = B("i")
a = A("a")
l = C("l")
k = D("k")
b = C("b")

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

class B:
    def __init__(self, txt: str):
        self.t: C = None
        self.u: A = None
        self.p: D = None
        self.w: D = None
        self.txt = txt

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

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

j = A("j")
d = B("d")
m = C("m")
f = D("f")
i = B("i")
a = A("a")
l = C("l")
k = D("k")
b = C("b")

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