class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.z: G = None
        self.y: D = None
        self.txt = txt

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.z: C = None
        self.w: B = None
        self.v: F = None
        self.u: C = None
        self.s: F = None
        self.txt = txt

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

c.t = f
c.z = m
c.y = b
a.u = b
a.o = f
a.p = f
a.q = l
f.q = k
b.x = f
b.s = a
b.y = a
b.z = m
b.w = l
b.r = c
b.p = k
l.o = c
k.u = l
k.s = l
k.p = f
k.z = b
k.y = m
k.v = a
k.r = a
m.z = f
m.u = f
m.w = a
m.v = k
m.s = k
assert k.p.q.p.q.z.p.r.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.z: G = None
        self.y: D = None
        self.txt = txt

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.z: C = None
        self.w: B = None
        self.v: F = None
        self.u: C = None
        self.s: F = None
        self.txt = txt

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

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