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

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

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

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

class E:
    def __init__(self, txt: str):
        self.r: F = None
        self.y: B = None
        self.w: C = None
        self.t: B = None
        self.u: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: E = None
        self.p: H = None
        self.w: E = None
        self.r: B = None
        self.v: D = None
        self.t: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.o: E = None
        self.p: F = None
        self.v: B = None
        self.w: B = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.v: G = None
        self.txt = txt

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.r: F = None
        self.y: B = None
        self.w: C = None
        self.t: B = None
        self.u: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: E = None
        self.p: H = None
        self.w: E = None
        self.r: B = None
        self.v: D = None
        self.t: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.o: E = None
        self.p: F = None
        self.v: B = None
        self.w: B = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.v: G = None
        self.txt = txt

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

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