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

class B:
    def __init__(self, txt: str):
        self.q: A = None
        self.r: A = None
        self.u: C = None
        self.txt = txt

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

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

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

g.w = k
c.q = i
c.r = g
c.u = l
l.y = d
l.z = i
l.v = k
n.y = l
n.x = l
n.s = j
n.w = j
i.w = k
j.y = l
j.x = l
j.s = n
j.w = n
d.w = k
f.q = i
f.r = i
f.u = l
k.q = g
k.r = g
k.u = l
assert g.w.u.y.w.u.v.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: A = None
        self.r: A = None
        self.u: C = None
        self.txt = txt

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

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

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

g.w = k
c.q = i
c.r = g
c.u = l
l.y = d
l.z = i
l.v = k
n.y = l
n.x = l
n.s = j
n.w = j
i.w = k
j.y = l
j.x = l
j.s = n
j.w = n
d.w = k
f.q = i
f.r = i
f.u = l
k.q = g
k.r = g
k.u = l
assert g.w.u.y.w.u.v.txt == "k"