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

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

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

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

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

l.w = b
l.u = f
a.p = f
a.v = f
a.x = f
g.r = e
f.q = j
f.p = l
f.u = i
f.z = i
b.p = f
b.v = f
b.x = f
i.p = f
i.v = f
i.x = f
j.r = e
d.p = f
d.v = f
d.x = f
e.w = d
e.u = f
assert e.u.z.v.q.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.u: D = None
        self.txt = txt

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

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

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

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

l.w = b
l.u = f
a.p = f
a.v = f
a.x = f
g.r = e
f.q = j
f.p = l
f.u = i
f.z = i
b.p = f
b.v = f
b.x = f
i.p = f
i.v = f
i.x = f
j.r = e
d.p = f
d.v = f
d.x = f
e.w = d
e.u = f
assert e.u.z.v.q.txt == "j"