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

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

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

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

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

i = A("i")
j = B("j")
f = C("f")
n = D("n")
h = E("h")
g = A("g")
b = D("b")
a = C("a")

i.o = h
i.y = h
i.u = f
i.x = g
j.p = b
f.x = a
f.r = j
f.y = n
n.z = g
n.u = j
h.z = b
g.o = h
g.y = h
g.u = f
g.x = i
b.z = i
b.u = j
a.x = f
a.r = j
a.y = n
assert h.z.z.x.u.y.u.p.u.txt == "
class A:
    def __init__(self, txt: str):
        self.o: E = None
        self.u: C = None
        self.x: A = None
        self.y: E = None
        self.txt = txt

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

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

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

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

i = A("i")
j = B("j")
f = C("f")
n = D("n")
h = E("h")
g = A("g")
b = D("b")
a = C("a")

i.o = h
i.y = h
i.u = f
i.x = g
j.p = b
f.x = a
f.r = j
f.y = n
n.z = g
n.u = j
h.z = b
g.o = h
g.y = h
g.u = f
g.x = i
b.z = i
b.u = j
a.x = f
a.r = j
a.y = n
assert h.z.z.x.u.y.u.p.u.txt == "j"