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

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.q: C = None
        self.p: A = None
        self.x: E = None
        self.s: C = None
        self.u: C = None
        self.o: C = None
        self.txt = txt

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

h.z = l
h.o = e
h.r = d
h.w = m
d.w = c
d.x = m
c.q = d
e.q = d
m.u = l
l.q = c
l.s = c
l.u = c
l.o = c
l.p = h
l.x = m
assert e.q.w.q.txt == "
class A:
    def __init__(self, txt: str):
        self.z: F = None
        self.o: D = None
        self.r: B = None
        self.w: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.q: C = None
        self.p: A = None
        self.x: E = None
        self.s: C = None
        self.u: C = None
        self.o: C = None
        self.txt = txt

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

h.z = l
h.o = e
h.r = d
h.w = m
d.w = c
d.x = m
c.q = d
e.q = d
m.u = l
l.q = c
l.s = c
l.u = c
l.o = c
l.p = h
l.x = m
assert e.q.w.q.txt == "d"