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

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

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

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

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

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

l.v = f
j.z = g
j.q = g
j.w = l
j.t = n
b.o = g
b.q = j
g.u = n
g.s = j
g.r = b
n.w = g
n.v = j
n.p = f
f.z = g
f.q = g
f.w = l
f.t = n
assert g.s.w.v.z.r.o.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.txt = txt

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

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

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

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

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

l.v = f
j.z = g
j.q = g
j.w = l
j.t = n
b.o = g
b.q = j
g.u = n
g.s = j
g.r = b
n.w = g
n.v = j
n.p = f
f.z = g
f.q = g
f.w = l
f.t = n
assert g.s.w.v.z.r.o.txt == "g"