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

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

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

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

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

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

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

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

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

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

c.q = b
c.w = a
c.s = a
c.t = f
i.y = a
i.u = a
j.z = c
j.x = c
j.w = b
j.v = f
l.x = b
l.p = a
l.u = i
d.z = b
d.w = c
d.x = c
d.v = j
a.x = b
a.p = l
a.u = i
b.q = c
b.w = a
b.s = l
b.t = d
h.z = c
h.w = c
h.x = c
h.v = j
f.z = b
f.w = b
f.x = c
f.v = j
assert h.z.t.w.s.txt == "l"