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

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

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

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

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

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

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

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

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

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

e.y = f
f.o = e
f.s = n
f.r = n
f.t = a
b.r = g
n.q = e
n.o = e
n.r = b
k.q = e
k.o = e
k.r = b
g.o = e
g.s = k
g.t = a
g.r = n
a.o = e
a.s = k
a.t = f
a.r = n
assert a.o.y.o.y.o.y.o.txt == "e"