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

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

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

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

l = A("l")
i = B("i")
f = C("f")
c = D("c")
h = B("h")
k = B("k")
g = B("g")
j = A("j")
a = C("a")
d = D("d")

l.r = c
l.z = f
i.r = a
i.v = l
i.t = f
f.u = i
c.y = a
c.p = a
c.z = a
c.s = l
h.r = f
h.t = f
h.v = j
k.r = f
k.t = f
k.v = j
g.r = a
g.t = a
g.v = j
j.r = d
j.z = a
a.u = k
d.y = a
d.p = f
d.z = f
d.s = l
assert i.r.u.t.u.t.u.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.z: C = None
        self.txt = txt

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

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

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

l = A("l")
i = B("i")
f = C("f")
c = D("c")
h = B("h")
k = B("k")
g = B("g")
j = A("j")
a = C("a")
d = D("d")

l.r = c
l.z = f
i.r = a
i.v = l
i.t = f
f.u = i
c.y = a
c.p = a
c.z = a
c.s = l
h.r = f
h.t = f
h.v = j
k.r = f
k.t = f
k.v = j
g.r = a
g.t = a
g.v = j
j.r = d
j.z = a
a.u = k
d.y = a
d.p = f
d.z = f
d.s = l
assert i.r.u.t.u.t.u.txt == "i"