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

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

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

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

h = A("h")
d = B("d")
k = C("k")
c = D("c")
e = A("e")
i = A("i")
j = B("j")
l = D("l")
f = C("f")

h.y = j
h.v = j
h.r = i
d.t = l
d.s = j
d.o = k
k.p = f
c.v = j
c.p = h
c.y = i
c.z = l
e.y = j
e.v = d
e.r = i
i.y = d
i.v = j
i.r = e
j.t = l
j.s = d
j.o = k
l.v = j
l.p = h
l.y = h
l.z = c
f.p = k
assert e.y.t.p.r.r.r.r.v.o.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.v: B = None
        self.r: A = None
        self.txt = txt

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

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

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

h = A("h")
d = B("d")
k = C("k")
c = D("c")
e = A("e")
i = A("i")
j = B("j")
l = D("l")
f = C("f")

h.y = j
h.v = j
h.r = i
d.t = l
d.s = j
d.o = k
k.p = f
c.v = j
c.p = h
c.y = i
c.z = l
e.y = j
e.v = d
e.r = i
i.y = d
i.v = j
i.r = e
j.t = l
j.s = d
j.o = k
l.v = j
l.p = h
l.y = h
l.z = c
f.p = k
assert e.y.t.p.r.r.r.r.v.o.txt == "k"