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

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

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

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

g = A("g")
n = B("n")
j = C("j")
m = D("m")
c = A("c")
d = B("d")
i = A("i")
k = C("k")

g.y = m
g.z = m
g.u = j
n.s = k
j.v = k
j.t = k
j.w = n
m.y = j
m.t = n
m.s = d
m.z = g
c.y = m
c.z = m
c.u = k
d.s = j
i.y = m
i.z = m
i.u = j
k.v = j
k.t = j
k.w = n
assert g.z.s.s.w.s.t.v.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.u: C = None
        self.z: D = None
        self.txt = txt

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

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

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

g = A("g")
n = B("n")
j = C("j")
m = D("m")
c = A("c")
d = B("d")
i = A("i")
k = C("k")

g.y = m
g.z = m
g.u = j
n.s = k
j.v = k
j.t = k
j.w = n
m.y = j
m.t = n
m.s = d
m.z = g
c.y = m
c.z = m
c.u = k
d.s = j
i.y = m
i.z = m
i.u = j
k.v = j
k.t = j
k.w = n
assert g.z.s.s.w.s.t.v.txt == "k"