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

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

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

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

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

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

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

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

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

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

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