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

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

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

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

class E:
    def __init__(self, txt: str):
        self.r: A = None
        self.y: B = None
        self.q: D = None
        self.u: C = None
        self.z: C = None
        self.txt = txt

d = A("d")
c = B("c")
g = C("g")
n = D("n")
l = E("l")

d.o = l
d.t = c
c.u = g
c.x = d
c.v = l
g.s = l
g.y = d
g.u = n
g.t = n
g.v = c
n.p = c
l.r = d
l.y = c
l.q = n
l.u = g
l.z = g
assert n.p.u.y.o.y.txt == "
class A:
    def __init__(self, txt: str):
        self.o: E = None
        self.t: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.r: A = None
        self.y: B = None
        self.q: D = None
        self.u: C = None
        self.z: C = None
        self.txt = txt

d = A("d")
c = B("c")
g = C("g")
n = D("n")
l = E("l")

d.o = l
d.t = c
c.u = g
c.x = d
c.v = l
g.s = l
g.y = d
g.u = n
g.t = n
g.v = c
n.p = c
l.r = d
l.y = c
l.q = n
l.u = g
l.z = g
assert n.p.u.y.o.y.txt == "c"