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

class B:
    def __init__(self, txt: str):
        self.t: A = None
        self.r: C = None
        self.u: A = None
        self.x: D = None
        self.txt = txt

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.t: A = None
        self.r: C = None
        self.u: A = None
        self.x: D = None
        self.txt = txt

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

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

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

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

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