class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: A = None
        self.t: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.q: B = None
        self.u: B = None
        self.w: E = None
        self.x: E = None
        self.txt = txt

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

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: A = None
        self.t: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.q: B = None
        self.u: B = None
        self.w: E = None
        self.x: E = None
        self.txt = txt

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

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

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