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

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

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

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

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

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

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

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

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

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

d.w = c
d.v = f
d.t = f
i.x = d
i.y = c
i.z = c
i.p = k
j.s = d
j.r = d
c.p = k
l.x = k
l.p = k
l.y = c
l.z = c
k.w = c
k.v = l
k.t = f
h.s = d
h.r = d
a.s = k
a.r = d
g.s = d
g.r = d
f.x = k
f.y = c
f.z = c
f.p = d
assert c.p.w.p.v.x.txt == "k"