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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.v: D = None
        self.txt = txt

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

b.o = j
a.s = k
a.o = n
m.p = c
d.p = g
d.o = g
d.r = b
d.x = m
d.t = m
k.r = c
e.v = c
g.v = d
n.o = a
c.p = e
c.r = b
c.x = m
c.t = m
c.o = g
j.s = k
j.o = n
assert j.s.r.o.v.o.v.p.v.x.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.v: D = None
        self.txt = txt

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

b.o = j
a.s = k
a.o = n
m.p = c
d.p = g
d.o = g
d.r = b
d.x = m
d.t = m
k.r = c
e.v = c
g.v = d
n.o = a
c.p = e
c.r = b
c.x = m
c.t = m
c.o = g
j.s = k
j.o = n
assert j.s.r.o.v.o.v.p.v.x.txt == "m"