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

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

class C:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

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

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

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

f.u = l
f.y = e
f.r = n
l.x = n
l.v = e
l.p = g
n.t = e
e.o = a
e.p = l
e.v = l
a.v = l
a.z = l
a.r = f
a.p = n
a.q = e
g.v = l
g.z = l
g.r = f
g.p = n
g.q = e
assert e.p.v.o.r.txt == "f"