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

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

class C:
    def __init__(self, txt: str):
        self.p: F = None
        self.o: F = None
        self.t: F = None
        self.z: F = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.p: E = None
        self.q: B = None
        self.r: G = None
        self.y: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.z: F = None
        self.txt = txt

h = A("h")
c = B("c")
n = C("n")
e = D("e")
g = E("g")
l = F("l")
a = G("a")
b = D("b")

h.q = g
c.r = a
n.p = l
n.o = l
n.t = l
n.z = l
e.t = h
e.y = h
e.w = n
e.r = n
e.s = g
e.q = l
g.q = h
g.w = h
g.p = n
l.p = g
l.q = c
l.r = a
l.y = a
a.z = l
b.t = h
b.y = h
b.w = n
b.r = n
b.s = g
b.q = l
assert a.z.r.z.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: F = None
        self.o: F = None
        self.t: F = None
        self.z: F = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.p: E = None
        self.q: B = None
        self.r: G = None
        self.y: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.z: F = None
        self.txt = txt

h = A("h")
c = B("c")
n = C("n")
e = D("e")
g = E("g")
l = F("l")
a = G("a")
b = D("b")

h.q = g
c.r = a
n.p = l
n.o = l
n.t = l
n.z = l
e.t = h
e.y = h
e.w = n
e.r = n
e.s = g
e.q = l
g.q = h
g.w = h
g.p = n
l.p = g
l.q = c
l.r = a
l.y = a
a.z = l
b.t = h
b.y = h
b.w = n
b.r = n
b.s = g
b.q = l
assert a.z.r.z.txt == "l"