class A:
    def __init__(self, txt: str):
        self.o: G = None
        self.t: E = None
        self.q: F = None
        self.p: G = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.x: C = None
        self.r: F = None
        self.z: E = None
        self.s: G = None
        self.u: A = None
        self.v: G = None
        self.t: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.z: G = None
        self.v: A = None
        self.txt = txt

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

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.x: C = None
        self.r: F = None
        self.z: E = None
        self.s: G = None
        self.u: A = None
        self.v: G = None
        self.t: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.z: G = None
        self.v: A = None
        self.txt = txt

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

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

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

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