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

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

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

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

n = A("n")
k = B("k")
m = C("m")
g = D("g")
j = A("j")

n.s = j
n.y = j
n.t = g
n.w = k
k.o = m
k.t = j
k.w = j
m.p = j
g.q = m
g.y = m
g.r = k
j.s = n
j.y = n
j.t = g
j.w = k
assert n.w.o.p.txt == "
class A:
    def __init__(self, txt: str):
        self.s: A = None
        self.y: A = None
        self.t: D = None
        self.w: B = None
        self.txt = txt

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

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

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

n = A("n")
k = B("k")
m = C("m")
g = D("g")
j = A("j")

n.s = j
n.y = j
n.t = g
n.w = k
k.o = m
k.t = j
k.w = j
m.p = j
g.q = m
g.y = m
g.r = k
j.s = n
j.y = n
j.t = g
j.w = k
assert n.w.o.p.txt == "j"