class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: D = None
        self.u: C = None
        self.w: C = None
        self.r: A = None
        self.s: D = None
        self.txt = txt

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

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

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

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

j = A("j")
g = B("g")
l = C("l")
f = D("f")
i = E("i")
h = F("h")
a = C("a")
c = C("c")
b = C("b")
e = B("e")

j.x = b
g.v = f
g.s = f
g.u = c
g.w = l
g.r = j
l.v = e
l.r = j
f.r = h
f.q = e
i.y = f
i.z = b
i.q = b
h.s = f
h.w = g
a.v = e
a.r = j
c.v = g
c.r = j
b.v = g
b.r = j
e.v = f
e.s = f
e.u = c
e.w = c
e.r = j
assert j.x.v.v.r.s.r.w.s.q.v.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: D = None
        self.u: C = None
        self.w: C = None
        self.r: A = None
        self.s: D = None
        self.txt = txt

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

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

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

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

j = A("j")
g = B("g")
l = C("l")
f = D("f")
i = E("i")
h = F("h")
a = C("a")
c = C("c")
b = C("b")
e = B("e")

j.x = b
g.v = f
g.s = f
g.u = c
g.w = l
g.r = j
l.v = e
l.r = j
f.r = h
f.q = e
i.y = f
i.z = b
i.q = b
h.s = f
h.w = g
a.v = e
a.r = j
c.v = g
c.r = j
b.v = g
b.r = j
e.v = f
e.s = f
e.u = c
e.w = c
e.r = j
assert j.x.v.v.r.s.r.w.s.q.v.txt == "f"