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

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

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

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

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

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

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

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

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

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

n.u = i
d.r = n
f.v = b
f.y = a
f.s = n
f.t = h
b.z = f
i.r = n
l.r = h
a.v = b
a.y = f
a.s = h
a.t = h
h.u = i
assert h.u.r.u.r.u.txt == "i"