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

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

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

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

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

f = A("f")
e = B("e")
a = C("a")
k = D("k")
g = E("g")
j = A("j")

f.x = j
f.q = e
e.u = j
e.y = f
e.w = a
e.o = g
e.s = g
a.x = e
a.s = k
k.q = a
k.s = a
k.v = f
k.o = f
g.p = e
g.s = f
j.x = f
j.q = e
assert f.x.q.u.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: A = None
        self.q: B = None
        self.txt = txt

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

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

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

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

f = A("f")
e = B("e")
a = C("a")
k = D("k")
g = E("g")
j = A("j")

f.x = j
f.q = e
e.u = j
e.y = f
e.w = a
e.o = g
e.s = g
a.x = e
a.s = k
k.q = a
k.s = a
k.v = f
k.o = f
g.p = e
g.s = f
j.x = f
j.q = e
assert f.x.q.u.x.x.txt == "j"