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

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

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

class D:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.t: F = None
        self.s: B = None
        self.r: A = None
        self.q: E = None
        self.y: E = None
        self.z: E = None
        self.txt = txt

l = A("l")
a = B("a")
f = C("f")
d = D("d")
h = E("h")
e = F("e")
k = G("k")

l.v = e
a.r = d
f.q = a
f.t = h
f.r = e
d.t = f
h.v = a
h.u = a
h.z = k
h.y = e
e.v = f
k.t = e
k.s = a
k.r = l
k.q = h
k.y = h
k.z = h
assert l.v.v.q.r.txt == "
class A:
    def __init__(self, txt: str):
        self.v: F = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.t: F = None
        self.s: B = None
        self.r: A = None
        self.q: E = None
        self.y: E = None
        self.z: E = None
        self.txt = txt

l = A("l")
a = B("a")
f = C("f")
d = D("d")
h = E("h")
e = F("e")
k = G("k")

l.v = e
a.r = d
f.q = a
f.t = h
f.r = e
d.t = f
h.v = a
h.u = a
h.z = k
h.y = e
e.v = f
k.t = e
k.s = a
k.r = l
k.q = h
k.y = h
k.z = h
assert l.v.v.q.r.txt == "d"