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

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

class C:
    def __init__(self, txt: str):
        self.q: G = None
        self.t: B = None
        self.w: A = None
        self.x: F = None
        self.u: D = None
        self.v: B = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.z: A = None
        self.y: B = None
        self.x: B = None
        self.q: B = None
        self.txt = txt

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.q: G = None
        self.t: B = None
        self.w: A = None
        self.x: F = None
        self.u: D = None
        self.v: B = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.z: A = None
        self.y: B = None
        self.x: B = None
        self.q: B = None
        self.txt = txt

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

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

l.y = d
d.y = m
d.q = f
d.v = l
d.t = l
d.z = j
d.w = e
m.q = e
m.t = d
m.v = d
m.w = f
m.x = c
m.u = b
b.v = m
b.t = g
b.x = e
b.r = e
b.w = j
b.u = d
j.z = c
j.r = b
c.z = f
c.y = d
c.x = d
c.q = d
e.p = d
e.r = g
e.w = m
g.v = m
g.t = b
g.x = e
g.r = e
g.w = j
g.u = d
f.y = d
assert c.z.y.w.w.w.y.q.y.q.txt == "f"