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

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: G = None
        self.y: F = None
        self.w: B = None
        self.txt = txt

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

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

i = A("i")
h = B("h")
e = C("e")
k = D("k")
n = E("n")
b = F("b")
g = G("g")
f = E("f")
j = A("j")
m = C("m")

i.q = e
i.x = h
h.r = j
e.w = m
e.o = n
e.r = k
k.r = f
k.o = i
k.z = g
n.q = g
n.y = b
n.w = h
b.o = e
g.z = i
g.x = h
f.q = g
f.y = b
f.w = h
j.q = e
j.x = h
m.w = e
m.o = f
m.r = k
assert k.o.x.r.q.o.q.x.r.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.x: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: G = None
        self.y: F = None
        self.w: B = None
        self.txt = txt

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

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

i = A("i")
h = B("h")
e = C("e")
k = D("k")
n = E("n")
b = F("b")
g = G("g")
f = E("f")
j = A("j")
m = C("m")

i.q = e
i.x = h
h.r = j
e.w = m
e.o = n
e.r = k
k.r = f
k.o = i
k.z = g
n.q = g
n.y = b
n.w = h
b.o = e
g.z = i
g.x = h
f.q = g
f.y = b
f.w = h
j.q = e
j.x = h
m.w = e
m.o = f
m.r = k
assert k.o.x.r.q.o.q.x.r.txt == "j"