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

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

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

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

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

i = A("i")
f = B("f")
b = C("b")
h = D("h")
j = E("j")
k = E("k")

i.u = f
f.q = h
b.x = k
h.s = b
h.x = i
j.v = k
j.z = h
j.x = f
j.t = f
k.v = j
k.z = h
k.x = f
k.t = f
assert h.s.x.v.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.txt = txt

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

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

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

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

i = A("i")
f = B("f")
b = C("b")
h = D("h")
j = E("j")
k = E("k")

i.u = f
f.q = h
b.x = k
h.s = b
h.x = i
j.v = k
j.z = h
j.x = f
j.t = f
k.v = j
k.z = h
k.x = f
k.t = f
assert h.s.x.v.txt == "j"