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

class B:
    def __init__(self, txt: str):
        self.v: B = None
        self.p: G = None
        self.q: C = None
        self.z: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: E = None
        self.y: E = None
        self.q: F = None
        self.w: G = None
        self.v: B = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.u: C = None
        self.p: C = None
        self.z: F = None
        self.r: E = None
        self.txt = txt

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

c.t = j
c.v = g
e.v = j
e.p = d
e.q = l
e.z = c
l.s = b
l.y = b
l.q = a
l.w = d
l.v = j
h.v = g
b.p = c
b.u = g
a.u = j
d.u = l
d.p = l
d.z = a
d.r = b
j.v = e
j.p = d
j.q = l
j.z = c
g.v = h
assert b.u.v.v.v.v.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.v: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: B = None
        self.p: G = None
        self.q: C = None
        self.z: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: E = None
        self.y: E = None
        self.q: F = None
        self.w: G = None
        self.v: B = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.u: C = None
        self.p: C = None
        self.z: F = None
        self.r: E = None
        self.txt = txt

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

c.t = j
c.v = g
e.v = j
e.p = d
e.q = l
e.z = c
l.s = b
l.y = b
l.q = a
l.w = d
l.v = j
h.v = g
b.p = c
b.u = g
a.u = j
d.u = l
d.p = l
d.z = a
d.r = b
j.v = e
j.p = d
j.q = l
j.z = c
g.v = h
assert b.u.v.v.v.v.v.v.txt == "g"