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

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

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

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

j = A("j")
b = B("b")
d = C("d")
f = D("f")
n = D("n")
e = A("e")
k = C("k")
c = A("c")
m = D("m")
g = A("g")

j.s = k
j.w = b
j.x = e
b.q = d
b.t = e
b.u = n
d.r = b
d.q = k
d.z = e
f.v = b
f.o = g
f.t = d
n.v = b
n.o = g
n.t = k
e.s = k
e.w = b
e.x = j
k.r = b
k.q = d
k.z = j
c.s = d
c.w = b
c.x = g
m.v = b
m.o = c
m.t = d
g.s = d
g.w = b
g.x = e
assert g.w.u.v.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.w: B = None
        self.x: A = None
        self.txt = txt

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

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

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

j = A("j")
b = B("b")
d = C("d")
f = D("f")
n = D("n")
e = A("e")
k = C("k")
c = A("c")
m = D("m")
g = A("g")

j.s = k
j.w = b
j.x = e
b.q = d
b.t = e
b.u = n
d.r = b
d.q = k
d.z = e
f.v = b
f.o = g
f.t = d
n.v = b
n.o = g
n.t = k
e.s = k
e.w = b
e.x = j
k.r = b
k.q = d
k.z = j
c.s = d
c.w = b
c.x = g
m.v = b
m.o = c
m.t = d
g.s = d
g.w = b
g.x = e
assert g.w.u.v.q.q.txt == "k"