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

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

class C:
    def __init__(self, txt: str):
        self.w: D = None
        self.o: C = None
        self.y: A = None
        self.txt = txt

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.w: D = None
        self.o: C = None
        self.y: A = None
        self.txt = txt

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

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

l.p = b
k.t = h
k.o = a
a.w = b
a.o = f
a.y = m
i.z = c
i.v = b
d.p = i
c.t = h
c.o = f
m.p = b
h.t = k
h.o = f
b.z = c
b.v = i
f.w = i
f.o = a
f.y = l
assert k.t.t.o.y.p.z.o.o.o.w.txt == "i"