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

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

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

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

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

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

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

c = A("c")
k = B("k")
l = C("l")
d = D("d")
e = E("e")
b = F("b")
f = G("f")
i = B("i")
a = A("a")

c.y = e
k.u = b
k.v = i
l.o = d
l.v = f
l.q = i
l.y = b
l.p = b
l.u = b
l.w = e
d.w = l
d.u = b
d.o = b
d.r = f
e.o = d
b.r = d
b.y = e
f.r = k
f.s = k
f.v = e
f.z = e
f.q = b
f.w = a
f.t = d
i.u = b
i.v = k
a.y = e
assert l.o.r.q.txt == "
class A:
    def __init__(self, txt: str):
        self.y: E = None
        self.txt = txt

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

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

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

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

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

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

c = A("c")
k = B("k")
l = C("l")
d = D("d")
e = E("e")
b = F("b")
f = G("f")
i = B("i")
a = A("a")

c.y = e
k.u = b
k.v = i
l.o = d
l.v = f
l.q = i
l.y = b
l.p = b
l.u = b
l.w = e
d.w = l
d.u = b
d.o = b
d.r = f
e.o = d
b.r = d
b.y = e
f.r = k
f.s = k
f.v = e
f.z = e
f.q = b
f.w = a
f.t = d
i.u = b
i.v = k
a.y = e
assert l.o.r.q.txt == "b"