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

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

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

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

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

a.v = f
a.s = f
a.o = d
a.q = c
h.r = l
c.x = k
c.r = k
c.s = d
n.u = l
n.v = l
n.o = l
i.x = k
i.r = k
i.s = d
f.x = k
f.s = c
f.r = h
k.r = n
l.u = n
l.v = n
l.o = n
d.x = k
d.s = f
d.r = h
assert d.s.x.r.u.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.o: C = None
        self.s: C = None
        self.q: C = None
        self.txt = txt

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

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

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

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

a.v = f
a.s = f
a.o = d
a.q = c
h.r = l
c.x = k
c.r = k
c.s = d
n.u = l
n.v = l
n.o = l
i.x = k
i.r = k
i.s = d
f.x = k
f.s = c
f.r = h
k.r = n
l.u = n
l.v = n
l.o = n
d.x = k
d.s = f
d.r = h
assert d.s.x.r.u.txt == "l"