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

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

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

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

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

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

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

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

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

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

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

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

h.q = i
k.y = f
k.u = b
k.p = h
f.x = b
b.s = f
c.x = b
c.t = k
c.p = h
i.x = b
i.t = k
i.p = h
assert c.p.q.x.s.x.txt == "b"