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

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

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

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

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

e = A("e")
b = B("b")
g = C("g")
m = D("m")
l = E("l")
c = A("c")
j = A("j")
a = A("a")
k = B("k")
h = C("h")

e.x = k
e.s = c
b.y = a
b.v = m
g.s = l
g.o = l
m.q = h
l.x = m
l.u = c
c.x = k
c.s = j
j.x = k
j.s = e
a.x = b
a.s = j
k.y = e
k.v = m
h.s = l
h.o = l
assert h.o.u.x.y.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.s: A = None
        self.txt = txt

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

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

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

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

e = A("e")
b = B("b")
g = C("g")
m = D("m")
l = E("l")
c = A("c")
j = A("j")
a = A("a")
k = B("k")
h = C("h")

e.x = k
e.s = c
b.y = a
b.v = m
g.s = l
g.o = l
m.q = h
l.x = m
l.u = c
c.x = k
c.s = j
j.x = k
j.s = e
a.x = b
a.s = j
k.y = e
k.v = m
h.s = l
h.o = l
assert h.o.u.x.y.txt == "e"