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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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