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

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

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

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

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

k = A("k")
b = B("b")
g = C("g")
l = D("l")
f = E("f")

k.r = g
k.x = f
k.z = b
b.u = g
g.q = k
g.s = l
g.r = f
l.o = b
l.w = g
l.v = k
f.u = k
f.p = k
f.o = g
f.y = l
f.x = b
assert b.u.s.w.s.o.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.x: E = None
        self.z: B = None
        self.txt = txt

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

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

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

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

k = A("k")
b = B("b")
g = C("g")
l = D("l")
f = E("f")

k.r = g
k.x = f
k.z = b
b.u = g
g.q = k
g.s = l
g.r = f
l.o = b
l.w = g
l.v = k
f.u = k
f.p = k
f.o = g
f.y = l
f.x = b
assert b.u.s.w.s.o.txt == "b"