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

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

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

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

e = A("e")
i = B("i")
c = C("c")
d = D("d")
f = D("f")
n = B("n")
g = C("g")
m = C("m")
j = C("j")

e.o = i
i.s = n
i.y = c
i.x = e
c.x = e
d.x = e
f.x = e
n.s = i
n.y = c
n.x = e
g.x = e
m.x = e
j.x = e
assert g.x.o.y.x.o.y.x.o.x.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.txt = txt

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

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

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

e = A("e")
i = B("i")
c = C("c")
d = D("d")
f = D("f")
n = B("n")
g = C("g")
m = C("m")
j = C("j")

e.o = i
i.s = n
i.y = c
i.x = e
c.x = e
d.x = e
f.x = e
n.s = i
n.y = c
n.x = e
g.x = e
m.x = e
j.x = e
assert g.x.o.y.x.o.y.x.o.x.txt == "e"