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

class B:
    def __init__(self, txt: str):
        self.v: B = None
        self.r: C = None
        self.x: E = None
        self.o: E = None
        self.s: E = None
        self.txt = txt

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

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

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

g = A("g")
m = B("m")
j = C("j")
n = D("n")
b = E("b")
k = B("k")
e = D("e")
c = C("c")

g.u = m
m.v = k
m.r = j
m.x = b
m.o = b
m.s = b
j.w = m
j.u = g
j.s = g
n.x = m
n.u = m
b.p = k
k.v = m
k.r = c
k.x = b
k.o = b
k.s = b
e.x = k
e.u = k
c.w = k
c.u = g
c.s = g
assert g.u.v.o.p.s.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: B = None
        self.r: C = None
        self.x: E = None
        self.o: E = None
        self.s: E = None
        self.txt = txt

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

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

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

g = A("g")
m = B("m")
j = C("j")
n = D("n")
b = E("b")
k = B("k")
e = D("e")
c = C("c")

g.u = m
m.v = k
m.r = j
m.x = b
m.o = b
m.s = b
j.w = m
j.u = g
j.s = g
n.x = m
n.u = m
b.p = k
k.v = m
k.r = c
k.x = b
k.o = b
k.s = b
e.x = k
e.u = k
c.w = k
c.u = g
c.s = g
assert g.u.v.o.p.s.txt == "b"