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

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

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

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

e = A("e")
l = B("l")
g = C("g")
k = D("k")
j = D("j")
b = D("b")

e.w = j
e.x = g
e.r = g
e.o = l
l.s = j
g.u = e
g.z = b
g.v = l
k.u = g
k.y = g
k.w = e
k.p = e
j.u = g
j.y = g
j.w = e
j.p = e
b.u = g
b.y = g
b.w = e
b.p = e
assert k.w.w.p.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.x: C = None
        self.r: C = None
        self.o: B = None
        self.txt = txt

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

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

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

e = A("e")
l = B("l")
g = C("g")
k = D("k")
j = D("j")
b = D("b")

e.w = j
e.x = g
e.r = g
e.o = l
l.s = j
g.u = e
g.z = b
g.v = l
k.u = g
k.y = g
k.w = e
k.p = e
j.u = g
j.y = g
j.w = e
j.p = e
b.u = g
b.y = g
b.w = e
b.p = e
assert k.w.w.p.w.txt == "j"