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

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

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

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

class E:
    def __init__(self, txt: str):
        self.t: A = None
        self.y: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.y: B = None
        self.t: C = None
        self.p: A = None
        self.w: E = None
        self.s: C = None
        self.txt = txt

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

a = A("a")
g = B("g")
b = C("b")
m = D("m")
e = E("e")
f = F("f")
j = G("j")

a.u = b
a.r = j
a.o = g
a.v = e
g.u = b
g.q = j
b.x = g
b.o = j
m.v = a
e.t = a
e.y = b
f.y = g
f.t = b
f.s = b
f.p = a
f.w = e
j.r = g
assert j.r.u.x.q.r.u.o.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.r: G = None
        self.o: B = None
        self.v: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.t: A = None
        self.y: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.y: B = None
        self.t: C = None
        self.p: A = None
        self.w: E = None
        self.s: C = None
        self.txt = txt

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

a = A("a")
g = B("g")
b = C("b")
m = D("m")
e = E("e")
f = F("f")
j = G("j")

a.u = b
a.r = j
a.o = g
a.v = e
g.u = b
g.q = j
b.x = g
b.o = j
m.v = a
e.t = a
e.y = b
f.y = g
f.t = b
f.s = b
f.p = a
f.w = e
j.r = g
assert j.r.u.x.q.r.u.o.txt == "j"