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

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

class C:
    def __init__(self, txt: str):
        self.v: G = None
        self.u: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.o: A = None
        self.t: C = None
        self.w: A = None
        self.s: H = None
        self.x: B = None
        self.v: C = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.t: H = None
        self.r: E = None
        self.s: C = None
        self.u: D = None
        self.q: D = None
        self.y: B = None
        self.txt = txt

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.v: G = None
        self.u: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.o: A = None
        self.t: C = None
        self.w: A = None
        self.s: H = None
        self.x: B = None
        self.v: C = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.t: H = None
        self.r: E = None
        self.s: C = None
        self.u: D = None
        self.q: D = None
        self.y: B = None
        self.txt = txt

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

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

j.x = f
f.r = j
f.o = n
c.v = n
c.u = l
b.r = n
l.o = j
l.w = j
l.t = c
l.v = c
l.s = m
l.x = f
h.v = l
h.p = l
h.x = m
n.t = m
n.r = l
n.s = c
n.u = b
n.q = b
n.y = f
m.v = j
m.r = n
assert f.r.x.r.x.o.q.txt == "b"