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

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

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

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

k = A("k")
a = B("a")
n = C("n")
j = D("j")
h = A("h")
l = C("l")
g = C("g")
b = B("b")
m = D("m")

k.u = a
k.s = a
a.t = k
a.q = k
a.w = j
a.o = b
n.v = k
n.x = k
j.s = n
j.u = a
j.p = k
j.q = b
h.u = b
h.s = b
l.v = h
l.x = k
g.v = k
g.x = k
b.t = k
b.q = k
b.w = j
b.o = a
m.s = l
m.u = b
m.q = b
m.p = k
assert g.v.u.o.o.w.s.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.s: B = None
        self.txt = txt

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

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

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

k = A("k")
a = B("a")
n = C("n")
j = D("j")
h = A("h")
l = C("l")
g = C("g")
b = B("b")
m = D("m")

k.u = a
k.s = a
a.t = k
a.q = k
a.w = j
a.o = b
n.v = k
n.x = k
j.s = n
j.u = a
j.p = k
j.q = b
h.u = b
h.s = b
l.v = h
l.x = k
g.v = k
g.x = k
b.t = k
b.q = k
b.w = j
b.o = a
m.s = l
m.u = b
m.q = b
m.p = k
assert g.v.u.o.o.w.s.txt == "n"