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

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

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

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

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

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

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

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

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

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

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

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

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