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

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

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

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

c = A("c")
g = B("g")
i = C("i")
e = D("e")
m = B("m")
h = A("h")
a = C("a")
k = A("k")
b = C("b")

c.v = e
g.r = i
g.w = k
g.s = e
i.v = g
i.u = a
e.y = h
e.s = b
e.v = m
e.q = g
m.r = i
m.w = k
m.s = e
h.v = e
a.v = m
a.u = i
k.v = e
b.v = g
b.u = a
assert g.s.v.r.v.s.s.u.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.txt = txt

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

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

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

c = A("c")
g = B("g")
i = C("i")
e = D("e")
m = B("m")
h = A("h")
a = C("a")
k = A("k")
b = C("b")

c.v = e
g.r = i
g.w = k
g.s = e
i.v = g
i.u = a
e.y = h
e.s = b
e.v = m
e.q = g
m.r = i
m.w = k
m.s = e
h.v = e
a.v = m
a.u = i
k.v = e
b.v = g
b.u = a
assert g.s.v.r.v.s.s.u.v.txt == "m"