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

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

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

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

a = A("a")
l = B("l")
e = C("e")
j = D("j")
i = B("i")
b = C("b")
m = D("m")
g = C("g")

a.s = g
a.x = m
a.p = m
a.q = l
l.u = e
e.y = j
e.s = m
j.w = e
j.u = i
i.u = b
b.y = j
b.s = m
m.w = g
m.u = l
g.y = j
g.s = m
assert i.u.y.w.y.u.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.x: D = None
        self.p: D = None
        self.q: B = None
        self.txt = txt

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

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

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

a = A("a")
l = B("l")
e = C("e")
j = D("j")
i = B("i")
b = C("b")
m = D("m")
g = C("g")

a.s = g
a.x = m
a.p = m
a.q = l
l.u = e
e.y = j
e.s = m
j.w = e
j.u = i
i.u = b
b.y = j
b.s = m
m.w = g
m.u = l
g.y = j
g.s = m
assert i.u.y.w.y.u.txt == "i"