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

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

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

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

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

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

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

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

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

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

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