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

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

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

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

e = A("e")
n = B("n")
k = C("k")
c = D("c")
m = C("m")
a = A("a")
g = B("g")
f = D("f")

e.o = f
e.s = a
e.y = a
e.q = a
n.y = g
n.p = f
k.r = m
k.q = n
k.t = c
c.r = n
c.t = k
c.v = k
m.r = k
m.q = g
m.t = f
a.o = f
a.s = e
a.y = e
a.q = e
g.y = n
g.p = f
f.r = g
f.t = m
f.v = m
assert e.s.o.t.t.t.r.q.p.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.s: A = None
        self.y: A = None
        self.q: A = None
        self.txt = txt

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

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

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

e = A("e")
n = B("n")
k = C("k")
c = D("c")
m = C("m")
a = A("a")
g = B("g")
f = D("f")

e.o = f
e.s = a
e.y = a
e.q = a
n.y = g
n.p = f
k.r = m
k.q = n
k.t = c
c.r = n
c.t = k
c.v = k
m.r = k
m.q = g
m.t = f
a.o = f
a.s = e
a.y = e
a.q = e
g.y = n
g.p = f
f.r = g
f.t = m
f.v = m
assert e.s.o.t.t.t.r.q.p.txt == "f"