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

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

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

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

class E:
    def __init__(self, txt: str):
        self.y: A = None
        self.x: B = None
        self.u: D = None
        self.s: D = None
        self.txt = txt

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.y: A = None
        self.x: B = None
        self.u: D = None
        self.s: D = None
        self.txt = txt

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

e.q = c
e.x = h
e.p = h
f.y = d
f.w = h
l.y = h
l.t = f
d.v = h
d.u = e
h.y = c
h.x = f
h.u = d
h.s = d
c.q = e
c.x = h
c.p = h
assert c.q.q.p.txt == "h"