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

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

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

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

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

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

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

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

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

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

k.x = j
i.q = a
i.u = h
j.r = c
j.v = c
j.w = c
j.y = h
b.z = c
b.w = f
b.q = f
b.t = a
a.q = h
a.u = i
h.q = i
h.u = i
l.q = h
l.u = i
c.r = j
c.v = j
c.w = j
c.y = a
m.x = c
f.z = c
f.w = b
f.q = b
f.t = a
assert b.t.u.q.txt == "a"