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

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

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

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

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

g = A("g")
k = B("k")
a = C("a")
b = D("b")
j = E("j")
d = A("d")
n = E("n")
i = C("i")

g.o = i
g.u = i
g.y = k
g.p = d
k.y = a
a.x = b
a.u = b
a.y = g
b.t = i
b.o = d
b.x = k
b.y = n
j.o = g
j.u = d
j.x = d
j.w = i
j.y = b
d.o = i
d.y = k
d.u = a
d.p = g
n.o = d
n.u = d
n.x = d
n.w = i
n.y = b
i.x = b
i.u = b
i.y = d
assert g.u.y.p.u.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.y: B = None
        self.u: C = None
        self.p: A = None
        self.txt = txt

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

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

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

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

g = A("g")
k = B("k")
a = C("a")
b = D("b")
j = E("j")
d = A("d")
n = E("n")
i = C("i")

g.o = i
g.u = i
g.y = k
g.p = d
k.y = a
a.x = b
a.u = b
a.y = g
b.t = i
b.o = d
b.x = k
b.y = n
j.o = g
j.u = d
j.x = d
j.w = i
j.y = b
d.o = i
d.y = k
d.u = a
d.p = g
n.o = d
n.u = d
n.x = d
n.w = i
n.y = b
i.x = b
i.u = b
i.y = d
assert g.u.y.p.u.txt == "i"