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

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

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

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

d = A("d")
b = B("b")
a = C("a")
l = D("l")
i = A("i")
g = A("g")
m = A("m")
h = A("h")
c = C("c")

d.v = l
d.q = l
d.p = l
d.w = m
b.w = c
b.s = c
b.t = i
a.t = l
a.u = b
a.s = b
a.v = b
l.p = b
l.s = b
i.v = l
i.q = l
i.p = l
i.w = h
g.v = l
g.q = l
g.p = l
g.w = i
m.v = l
m.q = l
m.p = l
m.w = h
h.v = l
h.q = l
h.p = l
h.w = g
c.t = l
c.u = b
c.s = b
c.v = b
assert a.u.t.w.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.q: D = None
        self.w: A = None
        self.p: D = None
        self.txt = txt

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

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

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

d = A("d")
b = B("b")
a = C("a")
l = D("l")
i = A("i")
g = A("g")
m = A("m")
h = A("h")
c = C("c")

d.v = l
d.q = l
d.p = l
d.w = m
b.w = c
b.s = c
b.t = i
a.t = l
a.u = b
a.s = b
a.v = b
l.p = b
l.s = b
i.v = l
i.q = l
i.p = l
i.w = h
g.v = l
g.q = l
g.p = l
g.w = i
m.v = l
m.q = l
m.p = l
m.w = h
h.v = l
h.q = l
h.p = l
h.w = g
c.t = l
c.u = b
c.s = b
c.v = b
assert a.u.t.w.txt == "h"