class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.txt = txt

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

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

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

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

b = A("b")
f = B("f")
m = C("m")
k = D("k")
c = E("c")
d = C("d")
e = B("e")

b.s = m
f.q = c
f.v = c
f.u = e
f.o = k
m.q = b
m.p = b
k.s = e
k.w = f
c.u = b
c.o = m
c.s = d
d.q = b
d.p = b
e.q = c
e.v = c
e.u = f
e.o = k
assert e.o.s.q.u.s.q.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.txt = txt

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

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

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

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

b = A("b")
f = B("f")
m = C("m")
k = D("k")
c = E("c")
d = C("d")
e = B("e")

b.s = m
f.q = c
f.v = c
f.u = e
f.o = k
m.q = b
m.p = b
k.s = e
k.w = f
c.u = b
c.o = m
c.s = d
d.q = b
d.p = b
e.q = c
e.v = c
e.u = f
e.o = k
assert e.o.s.q.u.s.q.txt == "b"