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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

a.u = m
a.v = m
a.q = h
a.s = h
m.z = a
m.o = a
m.r = g
m.p = f
m.x = l
l.x = h
b.o = m
b.t = f
g.t = m
g.z = a
f.v = b
h.v = g
assert b.t.v.t.v.o.r.txt == "g"