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

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

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

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

i = A("i")
b = B("b")
n = C("n")
a = D("a")
k = B("k")
m = D("m")
c = D("c")
j = A("j")
d = B("d")
l = A("l")

i.r = d
b.v = d
n.u = l
n.v = j
n.x = a
n.t = i
a.w = j
k.v = d
m.w = l
c.w = j
j.r = b
d.v = k
l.r = k
assert c.w.r.v.v.v.v.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.txt = txt

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

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

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

i = A("i")
b = B("b")
n = C("n")
a = D("a")
k = B("k")
m = D("m")
c = D("c")
j = A("j")
d = B("d")
l = A("l")

i.r = d
b.v = d
n.u = l
n.v = j
n.x = a
n.t = i
a.w = j
k.v = d
m.w = l
c.w = j
j.r = b
d.v = k
l.r = k
assert c.w.r.v.v.v.v.v.v.txt == "k"