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

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

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

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

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

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

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

e = A("e")
b = B("b")
d = C("d")
i = D("i")
k = E("k")
j = F("j")
c = G("c")
g = G("g")

e.t = b
e.v = d
b.t = i
b.x = e
d.t = j
d.o = j
d.u = c
i.v = g
k.v = b
k.q = j
k.y = d
j.u = e
j.y = e
j.q = i
j.p = i
j.v = b
j.w = k
c.z = j
g.z = j
assert j.w.q.w.q.v.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.v: C = None
        self.txt = txt

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

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

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

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

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

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

e = A("e")
b = B("b")
d = C("d")
i = D("i")
k = E("k")
j = F("j")
c = G("c")
g = G("g")

e.t = b
e.v = d
b.t = i
b.x = e
d.t = j
d.o = j
d.u = c
i.v = g
k.v = b
k.q = j
k.y = d
j.u = e
j.y = e
j.q = i
j.p = i
j.v = b
j.w = k
c.z = j
g.z = j
assert j.w.q.w.q.v.txt == "b"