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

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

class C:
    def __init__(self, txt: str):
        self.o: A = None
        self.x: C = None
        self.txt = txt

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.o: A = None
        self.x: C = None
        self.txt = txt

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

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

k.v = d
k.r = m
k.u = f
n.t = l
n.w = k
n.o = h
i.o = k
i.x = h
f.r = d
l.t = n
l.w = m
l.o = i
h.o = k
h.x = i
b.v = f
b.r = k
b.u = d
d.r = f
m.v = d
m.r = b
m.u = f
assert f.r.r.r.txt == "d"