class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.v: D = None
        self.s: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: C = None
        self.u: D = None
        self.x: D = None
        self.v: C = None
        self.z: G = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.q: G = None
        self.txt = txt

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

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

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

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

k.o = g
k.v = b
k.s = l
g.t = d
g.v = d
g.u = b
g.x = b
g.z = m
d.u = m
d.p = m
d.t = g
d.w = b
b.q = m
a.u = j
a.o = k
a.s = b
j.o = m
m.o = g
m.r = a
m.z = b
l.o = g
l.v = b
l.s = k
assert b.q.r.u.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.v: D = None
        self.s: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: C = None
        self.u: D = None
        self.x: D = None
        self.v: C = None
        self.z: G = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.q: G = None
        self.txt = txt

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

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

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

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

k.o = g
k.v = b
k.s = l
g.t = d
g.v = d
g.u = b
g.x = b
g.z = m
d.u = m
d.p = m
d.t = g
d.w = b
b.q = m
a.u = j
a.o = k
a.s = b
j.o = m
m.o = g
m.r = a
m.z = b
l.o = g
l.v = b
l.s = k
assert b.q.r.u.o.txt == "m"