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

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

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

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

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

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

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

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

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

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

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

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

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