class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.z: C = None
        self.q: E = None
        self.v: C = None
        self.txt = txt

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

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

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

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

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

b.s = j
b.z = h
b.v = h
b.q = k
j.u = c
h.u = k
c.u = j
k.v = b
assert h.u.v.v.u.v.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.z: C = None
        self.q: E = None
        self.v: C = None
        self.txt = txt

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

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

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

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

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

b.s = j
b.z = h
b.v = h
b.q = k
j.u = c
h.u = k
c.u = j
k.v = b
assert h.u.v.v.u.v.txt == "b"