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

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

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

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

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

l = A("l")
f = B("f")
b = C("b")
j = D("j")
g = E("g")
c = D("c")
e = B("e")
m = C("m")

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

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

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

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

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

l = A("l")
f = B("f")
b = C("b")
j = D("j")
g = E("g")
c = D("c")
e = B("e")
m = C("m")

l.x = b
l.v = f
l.p = f
l.o = j
f.o = b
f.q = b
f.r = g
f.u = e
f.v = l
b.x = m
b.z = l
b.y = l
b.q = g
b.o = c
j.q = e
g.x = e
g.u = m
c.q = f
e.o = m
e.q = m
e.r = g
e.u = f
e.v = l
m.x = b
m.z = l
m.y = l
m.q = g
m.o = c
assert g.u.x.x.o.q.r.u.x.txt == "b"