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

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

class C:
    def __init__(self, txt: str):
        self.p: B = None
        self.v: B = None
        self.t: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.q: B = None
        self.txt = txt

i = A("i")
j = B("j")
g = C("g")
e = D("e")
c = E("c")
a = A("a")

i.o = g
i.p = j
i.u = j
i.r = e
j.y = i
j.o = c
g.p = j
g.v = j
g.t = i
e.q = j
e.z = j
c.q = j
a.o = g
a.p = j
a.u = j
a.r = e
assert i.r.z.y.u.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.p: B = None
        self.r: D = None
        self.u: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: B = None
        self.v: B = None
        self.t: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.q: B = None
        self.txt = txt

i = A("i")
j = B("j")
g = C("g")
e = D("e")
c = E("c")
a = A("a")

i.o = g
i.p = j
i.u = j
i.r = e
j.y = i
j.o = c
g.p = j
g.v = j
g.t = i
e.q = j
e.z = j
c.q = j
a.o = g
a.p = j
a.u = j
a.r = e
assert i.r.z.y.u.o.txt == "c"