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

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

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

class D:
    def __init__(self, txt: str):
        self.z: E = None
        self.y: A = None
        self.w: E = None
        self.v: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.u: B = None
        self.w: B = None
        self.p: D = None
        self.t: C = None
        self.txt = txt

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

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

b = A("b")
n = B("n")
m = C("m")
c = D("c")
f = E("f")
i = F("i")
d = G("d")
l = F("l")
e = D("e")
g = G("g")

b.v = i
n.q = f
n.z = c
m.o = g
m.u = b
c.z = f
c.w = f
c.y = b
c.v = i
f.u = n
f.w = n
f.p = c
f.t = m
i.u = l
d.v = g
l.u = i
e.z = f
e.w = f
e.y = b
e.v = l
g.v = d
assert b.v.u.u.u.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.v: F = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.z: E = None
        self.y: A = None
        self.w: E = None
        self.v: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.u: B = None
        self.w: B = None
        self.p: D = None
        self.t: C = None
        self.txt = txt

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

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

b = A("b")
n = B("n")
m = C("m")
c = D("c")
f = E("f")
i = F("i")
d = G("d")
l = F("l")
e = D("e")
g = G("g")

b.v = i
n.q = f
n.z = c
m.o = g
m.u = b
c.z = f
c.w = f
c.y = b
c.v = i
f.u = n
f.w = n
f.p = c
f.t = m
i.u = l
d.v = g
l.u = i
e.z = f
e.w = f
e.y = b
e.v = l
g.v = d
assert b.v.u.u.u.u.u.u.txt == "i"