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

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

class C:
    def __init__(self, txt: str):
        self.p: C = None
        self.r: B = None
        self.s: D = None
        self.q: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.v: C = None
        self.q: A = None
        self.txt = txt

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

i.t = c
i.p = f
i.x = a
f.x = n
f.y = g
f.p = i
c.p = a
c.r = f
c.s = e
c.q = n
e.o = n
e.t = i
n.v = c
n.q = i
a.p = c
a.r = f
a.s = g
a.q = n
g.o = n
g.t = i
assert i.p.y.o.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.p: B = None
        self.x: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: C = None
        self.r: B = None
        self.s: D = None
        self.q: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.v: C = None
        self.q: A = None
        self.txt = txt

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

i.t = c
i.p = f
i.x = a
f.x = n
f.y = g
f.p = i
c.p = a
c.r = f
c.s = e
c.q = n
e.o = n
e.t = i
n.v = c
n.q = i
a.p = c
a.r = f
a.s = g
a.q = n
g.o = n
g.t = i
assert i.p.y.o.txt == "n"