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

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

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

class D:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

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

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

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

a = A("a")
g = B("g")
n = C("n")
l = D("l")
d = E("d")
e = F("e")
b = G("b")

a.v = l
a.x = b
g.x = b
g.t = e
n.x = a
n.p = d
l.z = g
d.u = b
d.o = g
d.p = g
d.r = n
d.z = a
d.w = l
e.r = d
b.y = d
b.z = g
assert a.x.y.o.x.z.t.r.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.x: G = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

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

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

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

a = A("a")
g = B("g")
n = C("n")
l = D("l")
d = E("d")
e = F("e")
b = G("b")

a.v = l
a.x = b
g.x = b
g.t = e
n.x = a
n.p = d
l.z = g
d.u = b
d.o = g
d.p = g
d.r = n
d.z = a
d.w = l
e.r = d
b.y = d
b.z = g
assert a.x.y.o.x.z.t.r.txt == "d"