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

class B:
    def __init__(self, txt: str):
        self.x: D = None
        self.t: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.s: D = None
        self.w: B = None
        self.t: D = None
        self.r: B = None
        self.txt = txt

a = A("a")
l = B("l")
n = C("n")
b = D("b")
f = C("f")
k = D("k")
j = C("j")
d = C("d")
h = A("h")

a.y = k
l.x = b
l.t = b
n.x = k
n.v = a
n.q = l
b.s = k
b.t = k
b.w = l
b.r = l
f.x = b
f.v = h
f.q = l
k.s = b
k.t = b
k.w = l
k.r = l
j.x = b
j.v = h
j.q = l
d.x = k
d.v = a
d.q = l
h.y = k
assert a.y.t.t.r.t.w.t.w.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: D = None
        self.t: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.s: D = None
        self.w: B = None
        self.t: D = None
        self.r: B = None
        self.txt = txt

a = A("a")
l = B("l")
n = C("n")
b = D("b")
f = C("f")
k = D("k")
j = C("j")
d = C("d")
h = A("h")

a.y = k
l.x = b
l.t = b
n.x = k
n.v = a
n.q = l
b.s = k
b.t = k
b.w = l
b.r = l
f.x = b
f.v = h
f.q = l
k.s = b
k.t = b
k.w = l
k.r = l
j.x = b
j.v = h
j.q = l
d.x = k
d.v = a
d.q = l
h.y = k
assert a.y.t.t.r.t.w.t.w.txt == "l"