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

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

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

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

g = A("g")
b = B("b")
d = C("d")
a = D("a")
k = A("k")
h = A("h")
i = D("i")
n = A("n")
l = B("l")

g.v = b
b.w = i
b.q = l
b.o = d
b.y = n
d.v = b
d.s = g
d.z = l
a.v = b
a.r = i
a.q = g
k.v = b
h.v = l
i.v = b
i.r = a
i.q = h
n.v = l
l.w = a
l.q = b
l.o = d
l.y = k
assert g.v.o.v.q.o.z.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.txt = txt

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

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

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

g = A("g")
b = B("b")
d = C("d")
a = D("a")
k = A("k")
h = A("h")
i = D("i")
n = A("n")
l = B("l")

g.v = b
b.w = i
b.q = l
b.o = d
b.y = n
d.v = b
d.s = g
d.z = l
a.v = b
a.r = i
a.q = g
k.v = b
h.v = l
i.v = b
i.r = a
i.q = h
n.v = l
l.w = a
l.q = b
l.o = d
l.y = k
assert g.v.o.v.q.o.z.txt == "l"