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

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

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

class D:
    def __init__(self, txt: str):
        self.y: F = None
        self.q: F = None
        self.txt = txt

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

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

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.y: F = None
        self.q: F = None
        self.txt = txt

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

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

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

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

f.t = g
f.q = g
f.s = a
f.r = j
a.v = f
n.t = b
n.r = b
n.y = a
n.p = j
n.x = j
g.y = b
g.q = b
j.w = b
j.x = g
j.z = a
b.t = f
b.v = g
b.z = a
b.y = a
e.y = g
e.u = b
assert n.y.v.q.q.v.y.txt == "b"