class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

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

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

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

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

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

e.z = f
b.v = a
b.p = a
b.s = a
b.o = j
b.r = e
j.v = a
j.o = l
j.q = f
f.x = b
l.s = e
l.t = e
l.x = c
c.v = a
c.o = l
c.q = f
a.v = b
a.p = b
a.s = b
a.o = c
a.r = e
assert f.x.r.z.x.r.z.x.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

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

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

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

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

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

e.z = f
b.v = a
b.p = a
b.s = a
b.o = j
b.r = e
j.v = a
j.o = l
j.q = f
f.x = b
l.s = e
l.t = e
l.x = c
c.v = a
c.o = l
c.q = f
a.v = b
a.p = b
a.s = b
a.o = c
a.r = e
assert f.x.r.z.x.r.z.x.txt == "b"