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

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

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

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

i = A("i")
h = B("h")
f = C("f")
k = D("k")
c = A("c")
g = A("g")
j = B("j")

i.r = g
i.x = h
i.u = k
h.s = f
h.t = f
h.w = j
h.u = c
f.s = c
f.y = g
f.u = k
k.o = f
k.w = h
c.r = g
c.x = j
c.u = k
g.r = c
g.x = h
g.u = k
j.s = f
j.t = f
j.w = h
j.u = g
assert k.w.w.t.u.o.y.u.txt == "
class A:
    def __init__(self, txt: str):
        self.r: A = None
        self.x: B = None
        self.u: D = None
        self.txt = txt

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

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

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

i = A("i")
h = B("h")
f = C("f")
k = D("k")
c = A("c")
g = A("g")
j = B("j")

i.r = g
i.x = h
i.u = k
h.s = f
h.t = f
h.w = j
h.u = c
f.s = c
f.y = g
f.u = k
k.o = f
k.w = h
c.r = g
c.x = j
c.u = k
g.r = c
g.x = h
g.u = k
j.s = f
j.t = f
j.w = h
j.u = g
assert k.w.w.t.u.o.y.u.txt == "k"