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

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

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

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

g = A("g")
j = B("j")
b = C("b")
h = D("h")
l = A("l")
a = C("a")
m = D("m")
f = D("f")

g.w = l
j.w = g
j.y = m
b.q = f
b.y = f
b.v = j
h.u = b
h.z = m
h.s = m
h.p = j
l.w = g
a.q = f
a.y = f
a.v = j
m.u = a
m.z = f
m.s = h
m.p = j
f.u = b
f.z = h
f.s = m
f.p = j
assert b.y.u.v.y.p.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: A = None
        self.txt = txt

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

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

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

g = A("g")
j = B("j")
b = C("b")
h = D("h")
l = A("l")
a = C("a")
m = D("m")
f = D("f")

g.w = l
j.w = g
j.y = m
b.q = f
b.y = f
b.v = j
h.u = b
h.z = m
h.s = m
h.p = j
l.w = g
a.q = f
a.y = f
a.v = j
m.u = a
m.z = f
m.s = h
m.p = j
f.u = b
f.z = h
f.s = m
f.p = j
assert b.y.u.v.y.p.w.w.txt == "l"