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

class B:
    def __init__(self, txt: str):
        self.u: A = None
        self.t: A = None
        self.x: G = None
        self.s: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.p: E = None
        self.x: H = None
        self.s: H = None
        self.v: H = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.r: H = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.t: A = None
        self.txt = txt

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

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

b.v = l
l.u = b
l.t = b
l.x = g
l.s = f
c.s = a
c.o = l
a.p = f
a.x = j
a.s = j
a.v = j
f.p = h
h.r = j
g.t = b
j.p = l
n.u = b
n.t = b
n.x = g
n.s = f
assert b.v.u.v.s.p.r.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: A = None
        self.t: A = None
        self.x: G = None
        self.s: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.p: E = None
        self.x: H = None
        self.s: H = None
        self.v: H = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.r: H = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.t: A = None
        self.txt = txt

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

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

b.v = l
l.u = b
l.t = b
l.x = g
l.s = f
c.s = a
c.o = l
a.p = f
a.x = j
a.s = j
a.v = j
f.p = h
h.r = j
g.t = b
j.p = l
n.u = b
n.t = b
n.x = g
n.s = f
assert b.v.u.v.s.p.r.txt == "j"