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

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

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

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

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

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

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

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

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

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

a.y = b
a.v = j
a.u = g
a.t = i
j.z = d
j.x = g
i.w = l
i.r = g
l.v = b
l.z = b
b.w = l
b.r = g
g.v = i
g.z = i
h.y = b
h.v = j
h.u = g
h.t = i
d.z = j
d.x = g
f.w = g
f.r = l
assert j.x.z.r.z.w.z.txt == "b"