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

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

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

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

c = A("c")
a = B("a")
b = C("b")
i = D("i")
g = B("g")
k = A("k")
n = A("n")
f = D("f")

c.v = i
c.t = b
c.y = g
a.s = b
a.w = g
b.z = a
b.v = a
b.x = k
b.t = i
i.w = a
g.s = b
g.w = a
k.v = i
k.t = b
k.y = g
n.v = f
n.t = b
n.y = a
f.w = a
assert a.w.s.t.w.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.t: C = None
        self.y: B = None
        self.txt = txt

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

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

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

c = A("c")
a = B("a")
b = C("b")
i = D("i")
g = B("g")
k = A("k")
n = A("n")
f = D("f")

c.v = i
c.t = b
c.y = g
a.s = b
a.w = g
b.z = a
b.v = a
b.x = k
b.t = i
i.w = a
g.s = b
g.w = a
k.v = i
k.t = b
k.y = g
n.v = f
n.t = b
n.y = a
f.w = a
assert a.w.s.t.w.w.w.txt == "a"