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

class B:
    def __init__(self, txt: str):
        self.u: G = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.r: E = None
        self.s: E = None
        self.v: E = None
        self.u: A = None
        self.t: C = None
        self.q: G = None
        self.w: E = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.o: D = None
        self.txt = txt

d = A("d")
c = B("c")
i = C("i")
l = D("l")
a = E("a")
h = F("h")
m = G("m")

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

class B:
    def __init__(self, txt: str):
        self.u: G = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.r: E = None
        self.s: E = None
        self.v: E = None
        self.u: A = None
        self.t: C = None
        self.q: G = None
        self.w: E = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.o: D = None
        self.txt = txt

d = A("d")
c = B("c")
i = C("i")
l = D("l")
a = E("a")
h = F("h")
m = G("m")

d.y = i
d.r = a
d.o = c
c.u = m
i.z = c
i.w = c
i.p = a
l.r = a
l.s = a
l.v = a
l.w = a
l.u = d
l.t = i
l.q = m
a.q = l
h.p = a
h.x = m
m.o = l
assert m.o.t.p.q.q.o.txt == "l"