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

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

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

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

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

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

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

e = A("e")
a = B("a")
k = C("k")
b = D("b")
m = E("m")
c = F("c")
d = G("d")
n = F("n")

e.r = b
a.o = m
a.z = k
k.t = d
b.y = c
b.q = c
b.p = e
m.r = b
m.y = b
m.t = b
m.q = k
m.s = k
c.p = b
c.o = e
d.x = e
d.t = c
d.o = a
n.p = b
n.o = e
assert m.s.t.o.o.q.t.o.z.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.txt = txt

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

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

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

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

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

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

e = A("e")
a = B("a")
k = C("k")
b = D("b")
m = E("m")
c = F("c")
d = G("d")
n = F("n")

e.r = b
a.o = m
a.z = k
k.t = d
b.y = c
b.q = c
b.p = e
m.r = b
m.y = b
m.t = b
m.q = k
m.s = k
c.p = b
c.o = e
d.x = e
d.t = c
d.o = a
n.p = b
n.o = e
assert m.s.t.o.o.q.t.o.z.txt == "k"