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

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

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

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

k = A("k")
f = B("f")
n = C("n")
j = D("j")
b = A("b")
e = B("e")
c = C("c")
d = C("d")
l = A("l")

k.r = f
f.u = k
n.x = j
n.y = j
j.v = c
j.s = l
b.r = f
e.u = b
c.x = j
c.y = j
d.x = j
d.y = j
l.r = f
assert k.r.u.r.u.r.u.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.txt = txt

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

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

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

k = A("k")
f = B("f")
n = C("n")
j = D("j")
b = A("b")
e = B("e")
c = C("c")
d = C("d")
l = A("l")

k.r = f
f.u = k
n.x = j
n.y = j
j.v = c
j.s = l
b.r = f
e.u = b
c.x = j
c.y = j
d.x = j
d.y = j
l.r = f
assert k.r.u.r.u.r.u.r.txt == "f"