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

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

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

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

k = A("k")
h = B("h")
i = C("i")
d = D("d")
g = A("g")
m = C("m")
f = D("f")
l = D("l")
n = B("n")

k.t = g
k.z = n
h.v = i
h.u = d
i.o = k
i.r = f
i.u = h
d.v = l
g.t = k
g.z = h
m.o = k
m.r = d
m.u = h
f.v = l
l.v = f
n.v = i
n.u = l
assert l.v.v.v.v.v.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.t: A = None
        self.z: B = None
        self.txt = txt

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

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

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

k = A("k")
h = B("h")
i = C("i")
d = D("d")
g = A("g")
m = C("m")
f = D("f")
l = D("l")
n = B("n")

k.t = g
k.z = n
h.v = i
h.u = d
i.o = k
i.r = f
i.u = h
d.v = l
g.t = k
g.z = h
m.o = k
m.r = d
m.u = h
f.v = l
l.v = f
n.v = i
n.u = l
assert l.v.v.v.v.v.v.v.txt == "f"