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

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

class C:
    def __init__(self, txt: str):
        self.r: A = None
        self.txt = txt

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

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

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

b.z = i
b.p = i
b.o = c
j.r = i
j.q = b
c.r = b
h.z = j
i.w = j
i.t = h
assert c.r.o.r.o.r.txt == "
class A:
    def __init__(self, txt: str):
        self.z: E = None
        self.p: E = None
        self.o: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.r: A = None
        self.txt = txt

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

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

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

b.z = i
b.p = i
b.o = c
j.r = i
j.q = b
c.r = b
h.z = j
i.w = j
i.t = h
assert c.r.o.r.o.r.txt == "b"