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

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

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

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

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

a.r = k
d.y = h
d.t = e
d.v = n
f.t = n
l.o = k
l.t = k
l.w = k
l.p = h
e.y = d
e.t = h
e.v = f
k.o = l
k.w = l
k.t = i
k.p = e
m.r = k
n.t = f
h.y = e
h.t = d
h.v = f
i.o = l
i.w = l
i.t = k
i.p = d
assert k.p.t.v.t.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.txt = txt

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

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

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

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

a.r = k
d.y = h
d.t = e
d.v = n
f.t = n
l.o = k
l.t = k
l.w = k
l.p = h
e.y = d
e.t = h
e.v = f
k.o = l
k.w = l
k.t = i
k.p = e
m.r = k
n.t = f
h.y = e
h.t = d
h.v = f
i.o = l
i.w = l
i.t = k
i.p = d
assert k.p.t.v.t.txt == "n"