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

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: B = None
        self.u: F = None
        self.w: D = None
        self.r: D = None
        self.q: F = None
        self.txt = txt

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

a = A("a")
h = B("h")
e = C("e")
l = D("l")
i = E("i")
d = F("d")
g = F("g")
m = F("m")
n = F("n")
b = B("b")

a.p = l
h.q = b
h.y = i
h.o = e
h.s = e
e.x = i
e.p = i
e.u = a
l.r = b
l.o = e
l.u = e
i.x = b
i.u = n
i.w = l
i.r = l
i.q = m
d.u = a
g.u = a
m.u = a
n.u = a
b.q = h
b.y = i
b.o = e
b.s = e
assert l.o.x.x.o.u.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: B = None
        self.u: F = None
        self.w: D = None
        self.r: D = None
        self.q: F = None
        self.txt = txt

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

a = A("a")
h = B("h")
e = C("e")
l = D("l")
i = E("i")
d = F("d")
g = F("g")
m = F("m")
n = F("n")
b = B("b")

a.p = l
h.q = b
h.y = i
h.o = e
h.s = e
e.x = i
e.p = i
e.u = a
l.r = b
l.o = e
l.u = e
i.x = b
i.u = n
i.w = l
i.r = l
i.q = m
d.u = a
g.u = a
m.u = a
n.u = a
b.q = h
b.y = i
b.o = e
b.s = e
assert l.o.x.x.o.u.txt == "a"