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

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

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

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

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

f.r = e
f.y = e
f.p = k
f.o = h
i.z = e
h.o = n
h.t = l
h.v = k
g.t = k
l.o = j
l.t = h
l.v = k
a.r = e
a.y = e
a.p = g
a.o = h
k.t = g
j.r = i
j.y = i
j.p = k
j.o = h
n.r = i
n.y = i
n.p = g
n.o = h
e.z = i
assert l.o.p.t.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.p: D = None
        self.y: B = None
        self.o: C = None
        self.txt = txt

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

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

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

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

f.r = e
f.y = e
f.p = k
f.o = h
i.z = e
h.o = n
h.t = l
h.v = k
g.t = k
l.o = j
l.t = h
l.v = k
a.r = e
a.y = e
a.p = g
a.o = h
k.t = g
j.r = i
j.y = i
j.p = k
j.o = h
n.r = i
n.y = i
n.p = g
n.o = h
e.z = i
assert l.o.p.t.t.t.txt == "g"