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

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

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

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

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

a.w = i
j.y = b
d.w = m
d.z = n
d.u = i
d.v = i
n.s = e
k.y = b
m.s = e
l.w = n
l.z = m
l.u = a
l.v = i
i.w = a
b.y = k
e.w = m
e.z = m
e.u = a
e.v = i
assert k.y.y.y.y.y.y.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.w: A = None
        self.txt = txt

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

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

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

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

a.w = i
j.y = b
d.w = m
d.z = n
d.u = i
d.v = i
n.s = e
k.y = b
m.s = e
l.w = n
l.z = m
l.u = a
l.v = i
i.w = a
b.y = k
e.w = m
e.z = m
e.u = a
e.v = i
assert k.y.y.y.y.y.y.y.y.txt == "k"