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

class B:
    def __init__(self, txt: str):
        self.t: B = None
        self.v: B = None
        self.s: C = None
        self.y: B = None
        self.txt = txt

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

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

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

k.w = m
k.q = m
k.y = i
a.t = j
a.v = j
a.y = j
a.s = d
d.x = j
c.s = j
c.r = i
c.x = i
j.t = a
j.v = a
j.y = a
j.s = d
i.s = j
i.r = c
i.x = c
m.w = k
m.q = k
m.y = c
assert c.s.s.x.v.t.txt == "
class A:
    def __init__(self, txt: str):
        self.w: A = None
        self.q: A = None
        self.y: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: B = None
        self.v: B = None
        self.s: C = None
        self.y: B = None
        self.txt = txt

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

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

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

k.w = m
k.q = m
k.y = i
a.t = j
a.v = j
a.y = j
a.s = d
d.x = j
c.s = j
c.r = i
c.x = i
j.t = a
j.v = a
j.y = a
j.s = d
i.s = j
i.r = c
i.x = c
m.w = k
m.q = k
m.y = c
assert c.s.s.x.v.t.txt == "j"