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

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

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

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

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

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

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

j = A("j")
f = B("f")
n = C("n")
c = D("c")
d = E("d")
e = F("e")
i = G("i")

j.x = d
j.t = c
f.r = j
f.q = j
n.q = i
n.v = e
n.r = d
c.r = d
c.w = d
c.x = d
c.t = n
c.u = f
c.s = i
c.z = i
d.s = c
d.t = c
d.w = j
e.w = n
e.y = n
e.s = c
i.w = e
i.o = e
assert j.t.z.w.txt == "
class A:
    def __init__(self, txt: str):
        self.x: E = None
        self.t: D = None
        self.txt = txt

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

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

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

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

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

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

j = A("j")
f = B("f")
n = C("n")
c = D("c")
d = E("d")
e = F("e")
i = G("i")

j.x = d
j.t = c
f.r = j
f.q = j
n.q = i
n.v = e
n.r = d
c.r = d
c.w = d
c.x = d
c.t = n
c.u = f
c.s = i
c.z = i
d.s = c
d.t = c
d.w = j
e.w = n
e.y = n
e.s = c
i.w = e
i.o = e
assert j.t.z.w.txt == "e"