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

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

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

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

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

f = A("f")
h = B("h")
i = C("i")
l = D("l")
c = E("c")

f.q = c
h.z = i
h.q = c
h.p = c
h.s = l
i.o = l
i.r = l
i.q = f
i.u = c
l.x = i
l.y = h
l.w = c
c.x = i
c.t = i
c.s = i
c.y = f
assert c.t.u.s.u.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

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

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

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

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

f = A("f")
h = B("h")
i = C("i")
l = D("l")
c = E("c")

f.q = c
h.z = i
h.q = c
h.p = c
h.s = l
i.o = l
i.r = l
i.q = f
i.u = c
l.x = i
l.y = h
l.w = c
c.x = i
c.t = i
c.s = i
c.y = f
assert c.t.u.s.u.txt == "c"