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

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

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

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

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

h = A("h")
i = B("i")
d = C("d")
b = D("b")
a = E("a")
e = C("e")
k = D("k")
c = B("c")
g = E("g")

h.x = e
i.y = b
i.s = e
d.x = h
d.o = h
d.t = b
d.s = a
b.s = k
a.o = h
e.x = h
e.o = h
e.t = b
e.s = a
k.s = b
c.y = k
c.s = e
g.o = h
assert e.x.x.t.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.txt = txt

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

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

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

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

h = A("h")
i = B("i")
d = C("d")
b = D("b")
a = E("a")
e = C("e")
k = D("k")
c = B("c")
g = E("g")

h.x = e
i.y = b
i.s = e
d.x = h
d.o = h
d.t = b
d.s = a
b.s = k
a.o = h
e.x = h
e.o = h
e.t = b
e.s = a
k.s = b
c.y = k
c.s = e
g.o = h
assert e.x.x.t.s.s.txt == "b"