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

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

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

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

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

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

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

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

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

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

i.r = k
i.o = d
i.t = b
a.p = i
d.s = n
d.p = b
d.v = h
h.p = n
h.r = d
h.s = i
h.x = b
b.r = i
b.t = i
b.o = d
k.r = b
k.o = n
k.t = i
l.p = b
n.s = d
n.p = i
n.v = h
c.p = d
c.r = d
c.s = k
c.x = i
assert l.p.r.r.o.v.txt == "h"