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

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

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

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

j = A("j")
f = B("f")
m = C("m")
l = D("l")
n = A("n")
a = C("a")
b = D("b")
h = B("h")
i = A("i")

j.z = i
f.y = m
f.o = l
m.v = b
m.y = a
l.t = b
l.u = b
l.r = m
n.z = i
a.v = b
a.y = m
b.t = l
b.u = l
b.r = a
h.y = a
h.o = b
i.z = n
assert f.o.u.r.v.t.r.txt == "
class A:
    def __init__(self, txt: str):
        self.z: A = None
        self.txt = txt

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

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

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

j = A("j")
f = B("f")
m = C("m")
l = D("l")
n = A("n")
a = C("a")
b = D("b")
h = B("h")
i = A("i")

j.z = i
f.y = m
f.o = l
m.v = b
m.y = a
l.t = b
l.u = b
l.r = m
n.z = i
a.v = b
a.y = m
b.t = l
b.u = l
b.r = a
h.y = a
h.o = b
i.z = n
assert f.o.u.r.v.t.r.txt == "m"