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

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

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

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

c = A("c")
e = B("e")
g = C("g")
i = D("i")
j = B("j")
k = B("k")
m = D("m")
f = D("f")
a = A("a")

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

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

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

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

c = A("c")
e = B("e")
g = C("g")
i = D("i")
j = B("j")
k = B("k")
m = D("m")
f = D("f")
a = A("a")

c.v = g
c.q = g
e.s = g
e.w = g
e.r = k
e.u = c
g.y = k
g.w = m
i.s = e
i.q = g
i.r = m
i.z = a
j.s = g
j.w = g
j.r = e
j.u = c
k.s = g
k.w = g
k.r = e
k.u = a
m.s = j
m.q = g
m.r = f
m.z = c
f.s = e
f.q = g
f.r = m
f.z = c
a.v = g
a.q = g
assert c.q.w.r.txt == "f"