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

class B:
    def __init__(self, txt: str):
        self.r: A = None
        self.t: D = None
        self.o: C = None
        self.txt = txt

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

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

d = A("d")
b = B("b")
k = C("k")
m = D("m")
l = D("l")
e = B("e")
a = B("a")
n = A("n")
h = C("h")
c = C("c")

d.s = n
d.y = k
d.p = e
b.r = d
b.t = l
b.o = h
k.x = h
k.z = l
k.r = l
k.q = b
m.v = k
l.v = c
e.r = n
e.t = l
e.o = k
a.r = d
a.t = l
a.o = h
n.s = d
n.y = c
n.p = b
h.x = c
h.z = l
h.q = b
h.r = m
c.x = k
c.z = m
c.q = e
c.r = l
assert n.p.r.s.p.r.p.o.x.q.t.txt == "
class A:
    def __init__(self, txt: str):
        self.s: A = None
        self.y: C = None
        self.p: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: A = None
        self.t: D = None
        self.o: C = None
        self.txt = txt

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

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

d = A("d")
b = B("b")
k = C("k")
m = D("m")
l = D("l")
e = B("e")
a = B("a")
n = A("n")
h = C("h")
c = C("c")

d.s = n
d.y = k
d.p = e
b.r = d
b.t = l
b.o = h
k.x = h
k.z = l
k.r = l
k.q = b
m.v = k
l.v = c
e.r = n
e.t = l
e.o = k
a.r = d
a.t = l
a.o = h
n.s = d
n.y = c
n.p = b
h.x = c
h.z = l
h.q = b
h.r = m
c.x = k
c.z = m
c.q = e
c.r = l
assert n.p.r.s.p.r.p.o.x.q.t.txt == "l"