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

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: A = None
        self.o: A = None
        self.p: D = None
        self.txt = txt

c = A("c")
e = B("e")
j = C("j")
i = D("i")
h = E("h")

c.q = e
c.v = e
c.s = i
e.t = h
e.y = j
e.q = i
j.v = e
i.q = h
h.q = c
h.o = c
h.p = i
assert j.v.t.p.q.o.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.s: D = None
        self.v: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: A = None
        self.o: A = None
        self.p: D = None
        self.txt = txt

c = A("c")
e = B("e")
j = C("j")
i = D("i")
h = E("h")

c.q = e
c.v = e
c.s = i
e.t = h
e.y = j
e.q = i
j.v = e
i.q = h
h.q = c
h.o = c
h.p = i
assert j.v.t.p.q.o.txt == "c"