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

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

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

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

n = A("n")
a = B("a")
k = C("k")
c = D("c")
f = D("f")
e = D("e")
h = A("h")

n.y = h
n.v = a
n.t = a
n.u = e
a.s = h
k.w = n
k.y = a
k.t = a
c.y = h
c.u = k
c.o = a
f.y = h
f.u = k
f.o = a
e.y = n
e.u = k
e.o = a
h.y = n
h.v = a
h.t = a
h.u = f
assert n.u.u.t.s.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.y: A = None
        self.v: B = None
        self.t: B = None
        self.u: D = None
        self.txt = txt

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

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

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

n = A("n")
a = B("a")
k = C("k")
c = D("c")
f = D("f")
e = D("e")
h = A("h")

n.y = h
n.v = a
n.t = a
n.u = e
a.s = h
k.w = n
k.y = a
k.t = a
c.y = h
c.u = k
c.o = a
f.y = h
f.u = k
f.o = a
e.y = n
e.u = k
e.o = a
h.y = n
h.v = a
h.t = a
h.u = f
assert n.u.u.t.s.u.u.txt == "k"