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

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

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

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

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

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

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

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

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

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

k.s = c
k.o = c
k.y = a
c.u = k
c.x = k
i.o = f
i.p = f
i.r = c
a.y = f
a.w = j
f.o = i
f.p = i
f.r = c
j.s = c
j.o = c
j.y = a
assert k.y.w.o.x.o.txt == "c"